dart-drift

Set up drift for type-safe SQLite and PostgreSQL persistence in Dart apps.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Dart applications often need reliable, cross-platform persistent storage. Drift provides a type-safe ORM for SQLite (with optional PostgreSQL) that works in CLI, server, and desktop Dart projects without Flutter.

Core Features & Use Cases

  • Type-safe queries, migrations, and reactive streams for Dart projects.
  • Cross-platform persistence with SQLite and optional PostgreSQL support, suitable for CLI tools, backend services, and non-Flutter desktop apps.
  • Real-world use: build a backend service that stores data locally and evolves the schema over time.

Quick Start

  1. Add drift and sqlite3 to pubspec.yaml, then run code generation with build_runner.
  2. Define your tables and create an AppDatabase class.
  3. Open a database connection (NativeDatabase.memory() for tests or LazyDatabase for file-based storage) and start using drift.

Frequently Asked Questions about dart-drift

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

FAQPage Schema
How do I set up local SQLite storage in a Dart CLI or backend service?

Set up local SQLite storage in Dart by adding drift and sqlite3 to your pubspec.yaml, running code generation with build_runner, defining table classes, and opening an AppDatabase connection via NativeDatabase or LazyDatabase to start querying.

What is the best way to manage database migrations for Dart apps without Flutter?

The best way to manage database migrations for Dart apps is using drift, which provides built-in schema migration support and type-safe queries for CLI tools, backend services, and non-Flutter desktop applications relying on SQLite or PostgreSQL.

Can I use drift for PostgreSQL connections in non-Flutter Dart projects?

Yes, you can use drift for PostgreSQL connections in non-Flutter Dart projects. Drift offers optional PostgreSQL support alongside SQLite, enabling cross-platform persistent storage for backend services and desktop applications.

Does drift support reactive streams for SQLite queries in Dart?

Yes, drift supports reactive streams for SQLite queries in Dart. It enables type-safe queries and reactive data streams, allowing your backend services or CLI tools to automatically respond to local database changes.

Do I need build_runner to use drift for persistent storage in Dart?

Yes, you need build_runner to use drift for persistent storage in Dart. Running build_runner handles the code generation required to create type-safe query classes and database structures from your table definitions.