flutter-drift

Implement persistent local storage with Drift and type-safe queries.

6|2|Updated Aug 14, 2025
One-click install
npx skills add https://github.com/Im5tu/claude --skill flutter-drift-im5tu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-drift
Source: https://github.com/Im5tu/claude/tree/main/skills/flutter-drift
Command: npx skills add https://github.com/Im5tu/claude --skill flutter-drift-im5tu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides Flutter developers to implement persistent local storage using Drift (SQLite) with type-safe queries and reactive data streams, reducing boilerplate and preventing data loss.

Core Features & Use Cases

  • Type-safe database integration for Flutter apps using drift_flutter
  • Reactive UI patterns with StreamBuilder and Provider/Riverpod
  • Cross-platform Drift setup for mobile, web, and desktop
  • Database migrations and CRUD operations with practical usage patterns
  • Use Case: Build a offline-first to-do app with real-time updates and migrations

Quick Start

Add dependencies drift, drift_flutter, and path_provider to pubspec.yaml and run code generation with drift_dev and build_runner. Create a Drift database class annotated with @DriftDatabase and implement the database with driftDatabase support for mobile/web/desktop. Run: dart run build_runner build. Then import the generated code and start using drift queries in your Flutter 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 local SQLite storage in Flutter using Drift?

Drift enables reactive local storage in Flutter by using SQLite under the hood and exposing data through streams. You connect these streams to a StreamBuilder to automatically rebuild your UI whenever underlying database records change.

Can I use Drift for cross-platform Flutter apps including web and desktop?

Database migrations in Drift are managed within your database class definition to safely evolve your schema. You implement migration strategies to alter tables during version updates, preventing data loss when modifying local storage structures.

Do I need build_runner to use Drift in a Flutter project?

Yes, you need build_runner alongside the drift_dev package to use Drift in a Flutter project. Running dart run build_runner build executes code generation, creating the type-safe boilerplate required for your SQLite queries and database setup.

How do I integrate Drift streams with Provider or Riverpod in Flutter?

You integrate Drift streams with Provider or Riverpod by exposing your Drift database instance through the state management layer. This injects reactive stream data into the widget tree, allowing StreamBuilder to observe local storage changes efficiently.