flutter-drift

Implement Drift for type-safe SQLite storage in Flutter apps.

104|17|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/MADTeacher/mad-agents-skills --skill flutter-drift
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-drift
Source: https://github.com/MADTeacher/mad-agents-skills/tree/main/flutter-drift
Command: npx skills add https://github.com/MADTeacher/mad-agents-skills --skill flutter-drift

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Flutter apps often need local, persistent storage with a robust API; Drift provides a SQLite-based solution with type-safe queries and reactive streams, but getting started and wiring codegen can be complex.

Core Features & Use Cases

  • Drift integration with flutter apps using drift_flutter for cross-platform local storage
  • Type-safe SQL queries with migrations and streams for reactive UI
  • Provider or Riverpod patterns for database access and state management
  • Reference examples and patterns for mobile, web, and desktop Flutter projects

Quick Start

  • Add drift, drift_flutter, and path_provider to pubspec.yaml
  • Define the database using DriftDatabase and create tables
  • Run code generation with build_runner to generate the data access code
  • Use the generated AppDatabase with Provider or Riverpod in your UI

Frequently Asked Questions about flutter-drift

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up type-safe local storage in Flutter using Drift?

To set up type-safe local storage with Drift, add the drift and drift_flutter packages to your pubspec.yaml, define your database using the DriftDatabase annotation, and run build_runner code generation to create the data access classes.

Does Drift support reactive queries for updating Flutter UI automatically?

Drift supports reactive queries by exposing streams that automatically emit new data when underlying SQLite tables change, allowing your Flutter UI to update in real time without manual refresh calls.

Can I use Drift for offline storage in Flutter web and desktop apps?

Drift works across Flutter mobile, web, and desktop platforms for offline local storage, using drift_flutter to handle platform-specific database initialization and file management via path_provider.

How do I manage SQLite schema migrations in a Flutter app with Drift?

Drift manages SQLite schema migrations through its built-in migration strategy, allowing you to define step-by-step schema changes between database versions while preserving existing local data during app updates.

What is the best way to integrate a Drift database with Riverpod or Provider in Flutter?

The best way to integrate Drift with Riverpod or Provider is to instantiate your generated AppDatabase and provide it through your chosen state management solution, enabling dependency injection and reactive UI updates.

Why does my Drift database code fail to compile before running build_runner?

Drift database code fails to compile before running build_runner because the type-safe query classes and data access methods do not exist yet; you must execute code generation to create the required source files.