flutter-drift
Installation
SKILL.md
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
- 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.
- Check
- 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
providerorflutter_riverpodonly when the app already uses it or the user asks for that integration.
- Create or update the database entry point:
- Define tables in Dart or
.driftfiles. - Add the tables to
@DriftDatabase. - Open Flutter databases with
driftDatabasefrompackage:drift_flutter/drift_flutter.dartunless the project needs a custom executor.
- Define tables in Dart or
- Keep Drift calls scoped to the database object:
- Use
database.select(database.todoItems),database.into(database.todoItems),database.update(database.todoItems), anddatabase.delete(database.todoItems)from widgets, services, and repositories. - Use bare
select(todoItems)only insideGeneratedDatabasesubclasses orDatabaseAccessorclasses where the methods and table getters are in scope.
- Use
Related skills
More from madteacher/mad-agents-skills
flutter-animations
>-
13.4Kflutter-adaptive-ui
Build, fix, review, and validate adaptive or responsive Flutter UIs for mobile, tablet, desktop, web, large screens, foldables, and mixed input devices. Use when creating breakpoint-driven layouts, responsive navigation, adaptive dialogs/lists/grids, keyboard/mouse/touch behavior, window-size decisions with MediaQuery or LayoutBuilder, or Capability and Policy patterns for platform-specific behavior.
1.5Kflutter-architecture
>-
1.4Kflutter-testing
>-
1.2Kflutter-networking
>-
552flutter-navigation
>-
440