flutterforge_ai 0.3.0
flutterforge_ai: ^0.3.0 copied to clipboard
AI-Ready Flutter template with built-in DB console, API inspector, state viewer, log viewer, and AI debug snapshots. Build observable apps that AI can debug with full context.
π οΈ FlutterForge AI #
FlutterForge AI is a developer toolkit that makes Flutter apps observable and AI-debuggable β DB, API, state, and logs in one place, exportable as a single AI-ready JSON snapshot.
One tap. One snapshot. Your AI fixes the bug.
Tap the π€ button in your app, paste the generated JSON into ChatGPT / Claude / Cursor, and get an accurate fix in seconds β complete with the database state, API history, provider values, and logs at the moment things went wrong.
π‘ This Flutter package is one of four components. The full ecosystem also ships a CLI (
flutterforge init/doctor/snapshot), a VS Code extension, and an optional self-hosted cloud receiver. See ECOSYSTEM.md for the overview.
(Replace doc/images/hero.gif with your own recording β see doc/WORKFLOW.md.)
π 30-second workflow #
ββ You hit a bug ββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β 1. Tap π€ in your app (or shake, or Alt+F12) β
β 2. Type the symptom: "Login loops after OAuth refresh" β
β 3. Tap "Copy AI prompt" β
β 4. Paste into ChatGPT / Claude / Cursor β
β 5. Get a contextual fix β the AI sees your DB rows, last β
β API calls, current provider state, and recent logs. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The snapshot is structured JSON β no screenshots, no guessing, no "it works on my machine".
β What's actually in the box #
Not promises β these are shipped and covered by tests.
| Capability | One-call API | UI |
|---|---|---|
| 4-tab DevTools dashboard | FFDevWrapper(child: ...) |
FFDevDashboard β DB / API / State / Logs |
| Database console + raw-SQL runner | FFDbHelper.instance.database |
DB tab |
| Alice-style API inspector with cURL export | FFApiClient.instance.dio |
API tab + detail view |
| Riverpod state viewer (live + history) | FFStateObserver() (as ProviderScope observer) |
State tab |
| Colour-coded log viewer with filters | FFLogger.info / .error / .warning / β¦ |
Logs tab |
| AI Debug Snapshot (the killer flow) | FFSnapshotGenerator.generate(problem: '...') |
π€ FAB β preview β Copy AI prompt |
| One-tap Diagnose with AI (BYO key) | FFAiClient.forConfig(config).diagnose(...) |
π€ FAB β preview β "Diagnose with AI" |
| Sensitive-data masking | automatic on all captures | β |
| Release-mode auto-disable | kReleaseMode gate |
β |
| Shake / Alt+F12 / draggable FAB triggers | all wired by FFDevWrapper |
β |
No vaporware section in this README. Everything above is in the latest published version on pub.dev.
β¨ Why FlutterForge AI? #
| Old paradigm | FlutterForge AI |
|---|---|
print() β guess β retry |
Tap button β paste β get fix |
| Hours of back-and-forth | 30 seconds |
| Screenshot + vague prompt | Structured JSON with real runtime |
| "It works on my machine" | "Here's exactly what happened" |
How it's different from Alice / Talker / pretty_dio_logger #
| Capability | FlutterForge AI | Alice | Talker | pretty_dio_logger |
|---|---|---|---|---|
| Dio interceptor + API inspector | β | β | β | β |
| Colour-coded log viewer | β | β | β | β |
| Live SQLite console + raw SQL runner | β | β | β | β |
| Riverpod state viewer (live + history) | β | β | β | β |
| Unified 4-tab devtools dashboard | β | β | β | β |
| One-tap AI debug snapshot (JSON) | β | β | β | β |
| Sensitive-data masking | β | β | β | β |
| Release-mode auto-disable | β | β | β | β |
FlutterForge AI is not another logger β it's a debugging surface that unifies every runtime signal into a single export designed for AI assistants.
π Features #
- ποΈ Database Console β browse tables, inspect schema, run raw SQL, optional web workbench via
sqflite_dev. - π API Inspector β Alice-style list of every Dio request, one-tap cURL export, sensitive header masking.
- π§ State Viewer β Riverpod provider list with live values and a change timeline (add / update / dispose / fail).
- π Log Viewer β Talker-style colour-coded log list with level filters, search, full stack traces.
- π€ AI Debug Snapshot β one call bundles DB + API + State + Logs + device info into an AI-ready prompt.
- π± Multiple triggers β draggable FAB, green π€ FAB, shake-to-open (mobile), Alt+F12 (desktop).
- π‘οΈ Sensitive-data masking β headers, body keys, and URL query params automatically redacted.
- π Release-safe β every devtool auto-disabled in
kReleaseMode. - π§ͺ Well tested β 45 unit tests covering ring buffer, masker, logger, interceptor, snapshot, and prompt formatter.
- π All platforms β Android, iOS, macOS, Windows, Linux, Web.
π¦ Installation #
flutter pub add flutterforge_ai
Or in pubspec.yaml:
dependencies:
flutterforge_ai: ^0.1.1
Dependency type:
dependencies(notdev_dependencies). The runtime APIs (FFLogger,FFApiClient,FFDbHelper) are called from production code paths; the devtools UI silently no-ops in release builds.
β‘ Quick start (3 lines) #
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutterforge_ai/flutterforge_ai.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. One-line init.
await FlutterForgeAI.init(
config: const FFConfig(appName: 'My App', baseUrl: 'https://api.example.com'),
);
runApp(
ProviderScope(
observers: [FFStateObserver()], // 2. Track Riverpod state
child: MaterialApp(
// 3. Inject the devtools overlay inside MaterialApp.builder.
builder: (ctx, child) => FFDevWrapper(child: child ?? const SizedBox()),
home: const MyHomePage(),
),
),
);
}
That's it. Tap the purple FAB for devtools, tap π€ for an AI snapshot.
π οΈ Usage #
Make API calls (auto-captured) #
final dio = FFApiClient.instance.dio;
final resp = await dio.get('/users');
Every request appears live in the API Inspector tab with method, URL, status, duration, full request/response, and a ready-to-paste cURL command.
Log anything (auto-captured) #
FFLogger.info('User logged in');
FFLogger.error('Payment failed', error: e, stackTrace: st);
All entries show up in the Log Viewer, filterable by level (verbose β fatal).
Query the database (auto-visible) #
final db = FFDbHelper.instance.database;
await db.insert('users', {'name': 'Alice'});
Open the Database Console tab to browse tables, inspect schema, and run ad-hoc SQL.
Generate an AI snapshot (one call) #
// Preferred: top-level facade on FlutterForgeAI.
final snap = await FlutterForgeAI.generateSnapshot(problem: 'Login loop');
final prompt = FFPromptFormatter.format(snap);
await FFClipboardHelper.copy(prompt);
// Snackbar: "β
Prompt copied. Paste to your AI assistant."
FlutterForgeAI.generateSnapshot(...) forwards to FFSnapshotGenerator.generate(...) β both APIs are supported; use whichever reads better at the call site.
Or just tap the π€ FAB and use the built-in preview screen.
π Configuration #
const config = FFConfig(
appName: 'My App',
dbName: 'my_app.db',
baseUrl: 'https://api.example.com',
envFile: '.env',
enableDevTools: true,
enableDbWorkbench: true,
dbWorkbenchPort: 8080,
enableAiDebugButton: true,
enableShakeToOpen: true,
shakeThreshold: 15.0,
enableKeyboardShortcut: true,
maxApiCallsStored: 200,
maxLogsStored: 500,
maxStateChangesStored: 300,
sensitiveHeaders: {'authorization', 'x-api-key', 'cookie'},
sensitiveBodyKeys: {'password', 'token', 'secret'},
apiTimeout: Duration(seconds: 30),
enablePrettyDioLogger: true,
persistSnapshots: false,
minLogLevel: FFLogLevel.verbose,
primaryColor: Color(0xFF6366F1),
devToolsTheme: ThemeMode.system,
);
For a release-tuned preset:
FFConfig.production(appName: 'My App'); // All devtools off, even in debug.
πΈ Screenshots #
The doc/images/ folder is the home for all recordings. Drop these four in to make the README self-explanatory:
| File | Shows |
|---|---|
doc/images/hero.gif |
Full workflow: bug β snapshot β AI fix (hero). |
doc/images/dashboard.png |
4-tab devtools dashboard. |
doc/images/api.png |
API Inspector with cURL export. |
doc/images/snapshot.png |
Snapshot preview + "Copy AI prompt" button. |
See doc/WORKFLOW.md for the step-by-step script.
ποΈ Architecture #
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FlutterForgeAI.init() β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββ βββββββββ ββββββββββββ βββββββββββββββββ β
β β Logger β β DB β β API/Dio β β State Observerβ β
β βββββ¬βββββ βββββ¬ββββ ββββββ¬ββββββ βββββββββ¬ββββββββ β
β βΌ βΌ βΌ βΌ β
β ββββββββββ βββββββββββ βββββββββββ ββββββββββββ β
β βLog storeβ βSchema + β βAPI storeβ βState storeβ β
β β(ring) β βSQL runr.β β(ring) β β(ring) β β
β ββββββ¬βββββ βββββββββββ ββββββ¬βββββ βββββββ¬βββββ β
β βΌ βΌ βΌ βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β FFSnapshotGenerator β β
β β β AI-ready JSON via FFPromptFormatter β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββ
β FFDevDashboard β
β DB β API β State β Logs
β + π€ AI button β
βββββββββββββββββββββ
See doc/architecture.md for the deep dive.
π€ The AI Debug Workflow #
- Your app hits a bug in development.
- Tap the green π€ FAB (or shake, or Alt+F12 β AI Snapshot).
- Optionally type the symptom ("Login loop after OAuth").
- Tap Copy AI prompt.
- Paste into ChatGPT / Claude / Cursor / Cody.
- Get a targeted, contextual fix.
Example auto-generated prompt:
I'm debugging a Flutter app. Here's the complete app context captured by
FlutterForge AI. Please analyse and suggest a fix.
PROBLEM: Login loop after OAuth
APP CONTEXT:
{
"flutterforge_version": "0.1.1",
"app": { "name": "My App", "version": "1.2.3" },
"device": { "platform": "android", "os_version": "14", "model": "Pixel 7" },
"database": { "tables": [ β¦ ] },
"api_logs": {
"recent_calls": [
{ "method": "POST", "url": "β¦/oauth/refresh", "status_code": 401, β¦ }
]
},
"app_state": {
"active_providers": [
{ "name": "authProvider", "current_value": "AuthState(token: null)" }
]
},
"logs": { "recent_entries": [ β¦ ] }
}
Please:
1. Identify the root cause.
2. Suggest specific code fixes.
3. Point to the exact provider / API call / DB query that's failing.
β FAQ #
Does FlutterForge AI ship in my release build?
Yes, it's imported, but every devtool, the shake detector, the floating buttons, and the snapshot generator are gated behind !kReleaseMode. In release, FFDevWrapper becomes a pass-through and FFSnapshotGenerator.generate() returns an empty snapshot.
Does the AI see my raw auth tokens?
No β everything goes through FFSensitiveDataMasker. Authorization, Cookie, X-API-Key headers, password / token / secret body keys, and ?token= URL params are replaced with *** before the call is even stored.
Should this be a dependency or dev_dependency?
Normal dependencies:. FFLogger, FFApiClient, and FFDbHelper are called from production code and must compile in release. Use FFConfig.production(appName: β¦) if you want every devtool silent.
Is sqflite_dev required?
No. It's an optional peer dependency. Add it to your dev_dependencies and the web workbench starts on port 8080 in debug; without it, the rest of the DB features still work.
Can I use a different state manager?
The package ships a Riverpod ProviderObserver. For Bloc / Provider / etc., just don't mount FFStateObserver β the DB / API / log surfaces stay useful.
Does it work on web?
Yes. Native-only features (sqflite workbench, shake detection) are skipped automatically; everything else works.
How much memory does it use?
Everything lives in fixed-size ring buffers you configure (maxLogsStored, maxApiCallsStored, β¦). Default footprint in debug is ~1 MB.
Can I persist snapshots?
Set persistSnapshots: true and the last snapshot is stored via SharedPreferences. Read it back with FFSnapshotGenerator.lastPersistedJson().
How do I contribute? See .github/CONTRIBUTING.md.
πΊοΈ Roadmap #
Shipped (this repo):
- β
Flutter package (
flutterforge_ai, on pub.dev) - β
CLI (
flutterforge init/doctor/snapshot) β seecli/ - π‘ VS Code extension v0.2 β tree view + rich webview, see
vscode/(needsnpm install && npm run compileto build locally) - π‘ Cloud receiver scaffold β see
cloud/(dev-only; no auth / persistence yet β parked post-v1)
Up next (ordered by impact, not effort):
- π΄ One-tap "Diagnose with AI" β in-app LLM call (bring-your-own-key: Anthropic / OpenAI). The snapshot round-trips to the model and the fix streams back into the preview screen. This is the magic moment; the clipboard copy is the fallback.
- π΄ CLI
init --auto-wireβ runflutter pub getand patchmain.dartwhen it matches a known shape (counter template, generated project), so "zero config" actually means zero. - π΄
doctor --fixβ apply the fixes the doctor suggests. - π Inline "diff" view in the State Viewer + time-travel scrubber.
- π GraphQL interceptor parity.
- π Bloc / Provider observer adapters.
- π Supabase / Firebase adapters.
- π VS Code live mode β attach to a running Flutter app via DevTools Extensions, pull snapshots without picking a file.
- βͺ Cloud v1 β auth, Postgres, agent inside the Flutter package that POSTs snapshots on uncaught error.
π License #
MIT Β© FlutterForge AI contributors β see LICENSE.