Repository navigation
chore: migrate to Flutter Edge AI 2.0 - #13
Conversation
Replace discontinued flutter_gemma dependencies with flutter_edge_ai 2.0 and matching litertlm, mediapipe, and speech satellites. Rename FlutterGemma to FlutterEdgeAi across the app, register TTS backends in main initialize, and bump minimum Flutter to 3.44. Co-authored-by: involvex <involvex@users.noreply.github.com>
|
Reviewer's GuideMigrates Nova’s on-device inference and TTS integration from the discontinued flutter_gemma packages to Flutter Edge AI 2.0, preserving existing model and orchestration flows while centralizing TTS backend setup and raising the minimum Flutter SDK requirement. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="lib/main.dart" line_range="61" />
<code_context>
- await FlutterGemma.initialize(
+ await FlutterEdgeAi.initialize(
inferenceEngines: const [LiteRtLmEngine(), MediaPipeEngine()],
+ ttsBackends: const [LiteRtTtsBackend()],
maxDownloadRetries: 3,
);
</code_context>
<issue_to_address>
**Core services remain uninitialized**
When TTS backend registration or initialization throws during startup, `FlutterEdgeAi.initialize` propagates the error into `main`'s shared startup catch, which skips `ModelManager.initialize`, `_repairModels`, and the remaining service initialization; the app launches without its normal model and core services.
Handle TTS initialization failure separately so model and service initialization can continue.
Also at `lib/main.dart:62`.
</issue_to_address>
### Comment 2
<location path="pubspec.yaml" line_range="17" />
<code_context>
+ # AI Inference — core + engines (Flutter Edge AI 2.0)
+ flutter_edge_ai: ^2.0.0
+ flutter_edge_ai_litertlm: ^1.8.7
+ flutter_edge_ai_mediapipe: ^1.0.9
# Permissions
</code_context>
<issue_to_address>
**Release vision inference fails**
When a release build uses the migrated MediaPipe plugin with a different Android namespace and its reflective classes rely on app-level keep rules, r8 applies the existing keep rule only to `dev.flutterberlin.flutter_gemma_mediapipe`, so it strips or renames the migrated plugin's needed classes and vision inference fails.
Update the app-level R8 keep rules to cover the migrated plugin's Android namespace, or provide equivalent consumer rules.
</issue_to_address>
### Comment 3
<location path="pubspec.yaml" line_range="8" />
<code_context>
environment:
sdk: '>=3.13.0-282.1.beta <4.0.0'
- flutter: '>=3.17.0-0.1.pre'
+ flutter: '>=3.44.0'
dependencies:
</code_context>
<issue_to_address>
**Documented Flutter versions cannot resolve**
When a developer follows a setup guide using Flutter 3.17 through 3.43, `pubspec.yaml` requires Flutter 3.44 or newer, so `flutter pub get` rejects the SDK and the developer cannot build Nova.
Update the Flutter prerequisite in both setup guides to require Flutter 3.44 or newer.
</issue_to_address>| await FlutterGemma.initialize( | ||
| await FlutterEdgeAi.initialize( | ||
| inferenceEngines: const [LiteRtLmEngine(), MediaPipeEngine()], | ||
| ttsBackends: const [LiteRtTtsBackend()], |
There was a problem hiding this comment.
🟠 High · Core services remain uninitialized
When TTS backend registration or initialization throws during startup, FlutterEdgeAi.initialize propagates the error into main's shared startup catch, which skips ModelManager.initialize, _repairModels, and the remaining service initialization; the app launches without its normal model and core services.
Handle TTS initialization failure separately so model and service initialization can continue.
Also at lib/main.dart:62.
Prompt for AI agents
In `lib/main.dart` at line 61:
**Core services remain uninitialized**
When TTS backend registration or initialization throws during startup, `FlutterEdgeAi.initialize` propagates the error into `main`'s shared startup catch, which skips `ModelManager.initialize`, `_repairModels`, and the remaining service initialization; the app launches without its normal model and core services.
Handle TTS initialization failure separately so model and service initialization can continue.
Also at `lib/main.dart:62`.| # AI Inference — core + engines (Flutter Edge AI 2.0) | ||
| flutter_edge_ai: ^2.0.0 | ||
| flutter_edge_ai_litertlm: ^1.8.7 | ||
| flutter_edge_ai_mediapipe: ^1.0.9 |
There was a problem hiding this comment.
🟡 Medium · Release vision inference fails
When a release build uses the migrated MediaPipe plugin with a different Android namespace and its reflective classes rely on app-level keep rules, r8 applies the existing keep rule only to dev.flutterberlin.flutter_gemma_mediapipe, so it strips or renames the migrated plugin's needed classes and vision inference fails.
Update the app-level R8 keep rules to cover the migrated plugin's Android namespace, or provide equivalent consumer rules.
Prompt for AI agents
In `pubspec.yaml` at line 17:
**Release vision inference fails**
When a release build uses the migrated MediaPipe plugin with a different Android namespace and its reflective classes rely on app-level keep rules, r8 applies the existing keep rule only to `dev.flutterberlin.flutter_gemma_mediapipe`, so it strips or renames the migrated plugin's needed classes and vision inference fails.
Update the app-level R8 keep rules to cover the migrated plugin's Android namespace, or provide equivalent consumer rules.| environment: | ||
| sdk: '>=3.13.0-282.1.beta <4.0.0' | ||
| flutter: '>=3.17.0-0.1.pre' | ||
| flutter: '>=3.44.0' |
There was a problem hiding this comment.
🟡 Medium · Documented Flutter versions cannot resolve
When a developer follows a setup guide using Flutter 3.17 through 3.43, pubspec.yaml requires Flutter 3.44 or newer, so flutter pub get rejects the SDK and the developer cannot build Nova.
Update the Flutter prerequisite in both setup guides to require Flutter 3.44 or newer.
Prompt for AI agents
In `pubspec.yaml` at line 8:
**Documented Flutter versions cannot resolve**
When a developer follows a setup guide using Flutter 3.17 through 3.43, `pubspec.yaml` requires Flutter 3.44 or newer, so `flutter pub get` rejects the SDK and the developer cannot build Nova.
Update the Flutter prerequisite in both setup guides to require Flutter 3.44 or newer.| // #endregion | ||
|
|
||
| await FlutterGemma.initialize( | ||
| await FlutterEdgeAi.initialize( |
There was a problem hiding this comment.
CRITICAL: TTS initialization failure skips all core service initialization
If FlutterEdgeAi.initialize() throws (e.g., TTS backend registration fails), the entire try block (lines 42-98) fails and the catch at line 96 only logs the error. ModelManager.instance.initialize(), _repairModels(), and all Future.wait service initializations are never executed. The app launches without models, memory, tasks, notes, notifications, TTS, MCP, etc.
Wrap the FlutterEdgeAi.initialize call in its own try-catch so failures don't block the rest of startup, or move TTS backend registration to a separate deferred initialization.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| await FlutterGemma.initialize( | ||
| await FlutterEdgeAi.initialize( | ||
| inferenceEngines: const [LiteRtLmEngine(), MediaPipeEngine()], | ||
| ttsBackends: const [LiteRtTtsBackend()], |
There was a problem hiding this comment.
CRITICAL: TTS backend registration failure propagates and blocks startup
The ttsBackends: const [LiteRtTtsBackend()] parameter is new in Flutter Edge AI 2.0. If TTS backend initialization fails (missing model, native lib issues, etc.), the exception propagates out of FlutterEdgeAi.initialize() and the shared catch block at line 96 catches it, skipping all subsequent initialization.
Handle TTS initialization separately so model and service initialization can continue even if TTS fails.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| @@ -1238,7 +1238,7 @@ class ModelManager { | |||
| /// Register a model already on disk (no download). | |||
There was a problem hiding this comment.
SUGGESTION: Comment still references old package name
The updated comment says registers with flutter_gemma but should say registers with Flutter Edge AI or registers with flutter_edge_ai for consistency with the migration.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| @@ -1008,7 +1008,7 @@ class ModelOrchestrator { | |||
| data: { | |||
There was a problem hiding this comment.
SUGGESTION: Comment references old package name
The debug log at line 1011 shows 'flutterHasActive': FlutterEdgeAi.hasActiveModel(), but the comment above (line 1008) says flutter_gemma's internal state. Should reference Flutter Edge AI / flutter_edge_ai.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
There was a problem hiding this comment.
I couldn't apply this fix automatically this time.
I could not start this fix because the account needs at least $1 in available credits.
Next steps:
- Add credits to your Kilo account, then retry the fix.
- Session ID:
agent_43a70669-3628-4cde-9a64-126457dd9be3
Technical details
Insufficient credits. Auto-fix requires at least $1 in available credits. Add credits, then retry.
There was a problem hiding this comment.
One or more Cloud Agent sessions failed:
- involvex/nova-assistant (agent_a3ac761f-78cc-4764-a398-0302a61d3cb4): Assistant request was rate limited
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
SUGGESTION
Files Reviewed (25 files)
|
Summary
Migrates Nova from discontinued
flutter_gemma*packages to Flutter Edge AI 2.0 (v2.0.0 release).flutter_edge_ai^2.0.0,flutter_edge_ai_litertlm^1.8.7,flutter_edge_ai_mediapipe^1.0.9,flutter_edge_ai_speech^0.5.3FlutterGemma→FlutterEdgeAi(imports + call sites)main()(LiteRtTtsBackend); removed duplicateinitializefromTtsServiceenvironment.flutterraised to>=3.44.0Nova does not use plugin RAG (
flutter_edge_ai_rag); customMemoryServiceis unchanged.Verification
flutter pub getflutter analyze— no issuesflutter test— all tests passedFollow-up (optional)
flutter_gemmain comments/UI copy.cursor/skills/nova-devFlutter version note with>=3.44.0Summary by Sourcery
Migrate Nova’s on-device AI and speech capabilities to Flutter Edge AI 2.0.
Enhancements:
Documentation: