Skip to content

chore: migrate to Flutter Edge AI 2.0 - #13

Merged
involvex merged 1 commit into
mainfrom
cursor/flutter-edge-ai-2-migration-8f3d
Oct 5, 2026
Merged

involvex merged 1 commit into
mainfrom
cursor/flutter-edge-ai-2-migration-8f3d

Conversation

@involvex

@involvex involvex commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

Migrates Nova from discontinued flutter_gemma* packages to Flutter Edge AI 2.0 (v2.0.0 release).

  • Dependencies: 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.3
  • API: FlutterGemma → FlutterEdgeAi (imports + call sites)
  • Init: TTS backends registered once in main() (LiteRtTtsBackend); removed duplicate initialize from TtsService
  • SDK: environment.flutter raised to >=3.44.0

Nova does not use plugin RAG (flutter_edge_ai_rag); custom MemoryService is unchanged.

Verification

  • flutter pub get
  • flutter analyze — no issues
  • flutter test — all tests passed

Follow-up (optional)

  • Update user-facing error strings that still mention flutter_gemma in comments/UI copy
  • Smoke test on a physical arm64 device: model download, chat, vision, TTS
  • Align .cursor/skills/nova-dev Flutter version note with >=3.44.0
Open in Web Open in Cursor 

Summary by Sourcery

Migrate Nova’s on-device AI and speech capabilities to Flutter Edge AI 2.0.

Enhancements:

  • Replace the discontinued flutter_gemma inference stack with Flutter Edge AI 2.0 across on-device model inference, model management, and text-to-speech.
  • Centralize TTS backend registration during application startup and raise the minimum supported Flutter SDK version to 3.44.0.

Documentation:

  • Update project documentation and changelog references for the Flutter Edge AI migration.

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>
@changeset-bot

changeset-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8a7faa6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sourcery-ai

sourcery-ai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Migrates 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

Change Details Files
Replaced the discontinued Flutter Gemma package family with the Flutter Edge AI 2.0 package family and updated application integration points.
  • Updated dependency versions and package imports across models, UI, orchestration, model management, tools, services, and tests.
  • Renamed core API calls from FlutterGemma to FlutterEdgeAi while preserving model installation, inference, lifecycle, and active-model handling flows.
  • Updated project documentation, architecture references, acknowledgments, and changelog.
pubspec.yaml
lib/models/external_tool.dart
lib/models/litert_model_catalog.dart
lib/models/model_info.dart
lib/models/uncensored_model_catalog.dart
lib/screens/assistant_screen.dart
lib/screens/custom_model_import_sheet.dart
lib/screens/settings_screen.dart
lib/services/huggingface_hub_service.dart
lib/services/mcp_service.dart
lib/services/model_manager.dart
lib/services/model_orchestrator.dart
lib/services/model_update_service.dart
lib/services/parallel_session_manager.dart
lib/services/platform_adaptation_service.dart
lib/services/session_history_reinjection.dart
lib/tools/tool_definitions.dart
test/models/custom_model_copy_with_test.dart
test/services/huggingface_hub_service_test.dart
AGENTS.md
README.md
docs/architecture.md
CHANGELOG.md
Centralized text-to-speech backend registration in application startup.
  • Registered LiteRtTtsBackend alongside inference engines during FlutterEdgeAi.initialize in main().
  • Removed duplicate TTS backend initialization from TtsService and migrated TTS installation, lookup, and synthesis calls to the new API.
  • Replaced the speech dependency with flutter_edge_ai_speech.
lib/main.dart
lib/services/tts_service.dart
pubspec.yaml
Raised the minimum supported Flutter SDK version for the new plugin release.
  • Changed the minimum Flutter constraint to >=3.44.0.
pubspec.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@involvex
involvex marked this pull request as ready for review October 5, 2026 17:49

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Fix all in Cursor


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread lib/main.dart
await FlutterGemma.initialize(
await FlutterEdgeAi.initialize(
inferenceEngines: const [LiteRtLmEngine(), MediaPipeEngine()],
ttsBackends: const [LiteRtTtsBackend()],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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`.

Fix in Cursor

Comment thread pubspec.yaml
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Fix in Cursor

Comment thread pubspec.yaml
environment:
sdk: '>=3.13.0-282.1.beta <4.0.0'
flutter: '>=3.17.0-0.1.pre'
flutter: '>=3.44.0'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Fix in Cursor

Comment thread lib/main.dart
// #endregion

await FlutterGemma.initialize(
await FlutterEdgeAi.initialize(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/main.dart
await FlutterGemma.initialize(
await FlutterEdgeAi.initialize(
inferenceEngines: const [LiteRtLmEngine(), MediaPipeEngine()],
ttsBackends: const [LiteRtTtsBackend()],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kilocode-bot fix it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One or more Cloud Agent sessions failed:

  • involvex/nova-assistant (agent_a3ac761f-78cc-4764-a398-0302a61d3cb4): Assistant request was rate limited

@kilo-code-bot

kilo-code-bot Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 2
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

CRITICAL

File Line Issue
lib/main.dart 59 TTS initialization failure skips all core service initialization
lib/main.dart 61 TTS backend registration failure propagates and blocks startup

SUGGESTION

File Line Issue
lib/services/model_manager.dart 1238 Comment still references old package name flutter_gemma
lib/services/model_orchestrator.dart 1008 Comment references old package name flutter_gemma
Files Reviewed (25 files)
  • AGENTS.md
  • CHANGELOG.md
  • README.md
  • docs/architecture.md
  • lib/main.dart
  • lib/models/external_tool.dart
  • lib/models/litert_model_catalog.dart
  • lib/models/model_info.dart
  • lib/models/uncensored_model_catalog.dart
  • lib/screens/assistant_screen.dart
  • lib/screens/custom_model_import_sheet.dart
  • lib/screens/settings_screen.dart
  • lib/services/huggingface_hub_service.dart
  • lib/services/mcp_service.dart
  • lib/services/model_manager.dart
  • lib/services/model_orchestrator.dart
  • lib/services/model_update_service.dart
  • lib/services/parallel_session_manager.dart
  • lib/services/platform_adaptation_service.dart
  • lib/services/session_history_reinjection.dart
  • lib/services/tts_service.dart
  • lib/tools/tool_definitions.dart
  • pubspec.yaml
  • test/models/custom_model_copy_with_test.dart
  • test/services/huggingface_hub_service_test.dart

Fix these issues in Kilo Cloud

@involvex
involvex merged commit a767984 into main Oct 5, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants