Flutter Drift logo

Flutter Drift

Community
MADTeacher
flutter-drift

Implement, fix, review, migrate, test, or debug Drift persistence in Flutter apps using SQLite, drift_flutter, type-safe Dart queries, generated tables, StreamBuilder or Riverpod StreamProvider UI, write operations, transactions, schema migrations, web assets, isolate sharing, and local database testing. Use when a Flutter task mentions drift, local database storage, SQLite, reactive database streams, CRUD, schemaVersion, build_runner, drift_dev make-migrations, migration tests, or Flutter-specific database setup across mobile, web, or desktop.

Overview

PublisherMADTeacher
Repositorymad-agents-skills
Skill nameflutter-drift
Stars
109
Forks
20
Bundled files
7
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by MADTeacher on GitHub. Read the source before you install it.

Installation

Install the Flutter Drift AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MADTeacher/mad-agents-skills.git /tmp/mad-agents-skills
mkdir -p .claude/skills
cp -r /tmp/mad-agents-skills/flutter-drift .claude/skills/flutter-drift
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Flutter Drift in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Flutter Drift on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Flutter Drift is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Flutter Drift

Use this skill to add or repair Drift-based local persistence in Flutter apps. The skill is an operating workflow: inspect the target app first, choose only the relevant reference files, implement with current Drift APIs, and validate generated code.

Core Workflow

  1. Inspect the app before editing:
    • Check pubspec.yaml, existing database files, build.yaml, state management package, target platforms, and tests.
    • Prefer the app's current architecture and naming over the examples in this skill.
  2. Add or verify dependencies with package commands instead of hardcoding versions:
    • dart pub add drift drift_flutter path_provider dev:drift_dev dev:build_runner
    • Add provider or flutter_riverpod only when the app already uses it or the user asks for that integration.
  3. Create or update the database entry point:
    • Define tables in Dart or .drift files.
    • Add the tables to @DriftDatabase.
    • Open Flutter databases with driftDatabase from package:drift_flutter/drift_flutter.dart unless the project needs a custom executor.
  4. Keep Drift calls scoped to the database object:
    • Use database.select(database.todoItems), database.into(database.todoItems), database.update(database.todoItems), and database.delete(database.todoItems) from widgets, services, and repositories.
    • Use bare select(todoItems) only inside GeneratedDatabase subclasses or DatabaseAccessor classes where the methods and table getters are in scope.
  5. Generate code after changing Drift declarations:
    • Run dart run build_runner build.
    • Treat generator errors as blockers, not optional cleanup.
  6. For schema changes in an existing app, use Drift's guided migration workflow:
    • Configure drift_dev databases in build.yaml.
    • Run dart run drift_dev make-migrations before and after schema changes as needed.
    • Bump schemaVersion, write generated step-by-step migrations, and run generated migration tests.
  7. Validate before finishing:
    • Run dart format on edited Dart files.
    • Run flutter analyze or dart analyze for the package.
    • Run targeted tests, including generated migration tests when migrations changed.

Resource Routing

  • Read references/setup.md when adding Drift, opening a database, configuring web support, or sharing a database across isolates.
  • Read references/tables.md when defining tables, columns, defaults, keys, indexes, constraints, generated columns, or strict tables.
  • Read references/queries.md when implementing selects, filters, sorting, pagination, joins, aggregations, subqueries, custom columns, or unions.
  • Read references/writes.md when implementing inserts, updates, deletes, upserts, companions, transactions, or batch operations.
  • Read references/streams.md when implementing reactive Drift streams, StreamBuilder, StreamProvider, custom select streams, table update listeners, or manual stream invalidation.
  • Read references/migrations.md when schemaVersion, existing user data, build.yaml, make-migrations, generated schema files, or migration tests are involved.
  • Read references/flutter-ui.md when wiring Drift data into Flutter widgets with Provider, Riverpod, StreamBuilder, search, filtering, pagination, or user-facing loading and error states.

Required API Rules

  • Do not call select(database.table) as a top-level function from a widget. Use database.select(database.table) outside database classes.
  • Do not use watch(...), todoUpdates(...), or notifyTableUpdates(...). Use customSelect(...).watch(), tableUpdates(...), and notifyUpdates(...).
  • Do not call delete(table).go(id). Add a where clause and then call go(), or use generated table extension helpers if the project already uses them.
  • Do not use batch.updateAll(...) or pass raw ids to batch.delete(...). Use batch.update(..., where: ...), batch.delete(...) with an insertable row, or batch.deleteWhere(...).
  • Do not mix Provider and Riverpod APIs. Provider.of<AppDatabase>(context) belongs to provider; Provider<AppDatabase>((ref) { ... }) and AsyncValue.when(...) belong to Riverpod.
  • Do not bump schemaVersion without a migration plan for existing databases.
  • Do not rely on raw SQLite writes when UI streams must update. Use Drift write APIs or call notifyUpdates with explicit TableUpdate metadata.

Fallbacks

  • If package downloads are blocked, update source files and leave exact dart pub add or flutter pub add commands for the user, then state that dependency resolution was not validated.
  • If a project cannot run build_runner, do not hand-write generated *.g.dart files. Fix source declarations and report the generator blocker.
  • If migration state is unclear, stop before changing schemaVersion; ask for the current released schema history or database files.
  • If web support is required but sqlite3.wasm and drift_worker.js are missing, add the code path and explicitly report the required web assets.

Validation Checklist

  • pubspec.yaml contains Drift runtime and generator dependencies.
  • Database files have valid part directives, table declarations, @DriftDatabase, constructor, and schemaVersion.
  • All query and write examples are scoped to the correct database/accessor context.
  • Generated code was rebuilt with build_runner.
  • Flutter UI examples handle loading, empty, error, and data states without treating AsyncValue as a List.
  • Migrations changed only with generated schema snapshots, step-by-step migration code, and tests.
  • flutter analyze or dart analyze passes for the edited package, or any remaining analyzer failure is reported with the blocker.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Flutter Drift AI skill do?

Implement, fix, review, migrate, test, or debug Drift persistence in Flutter apps using SQLite, drift_flutter, type-safe Dart queries, generated tables, StreamBuilder or Riverpod StreamProvider UI, write operations, transactions, schema migrations, web assets, isolate sharing, and local database testing. Use when a Flutter task mentions drift, local database storage, SQLite, reactive database streams, CRUD, schemaVersion, build_runner, drift_dev make-migrations, migration tests, or Flutter-specific database setup across mobile, web, or desktop.

Why use Flutter Drift on TypingMind?

Because you install it once and use it with any model. Flutter Drift is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Flutter Drift in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MADTeacher/mad-agents-skills/tree/main/flutter-drift. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Flutter Drift?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Flutter Drift?

As many as you like. As long as a model supports skills, you can use Flutter Drift with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Flutter Drift AI skill free?

Yes. It is published on GitHub by MADTeacher under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇