dart-drift

Configure Drift for type-safe SQLite or PostgreSQL persistence in Dart applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a practical guide for using Drift to implement persistent storage in Dart applications (CLI tools, backend services, and server-side Dart apps) with local SQLite and optional PostgreSQL support. It helps developers achieve type-safe queries, reactive streams, and robust migrations without fumbling through setup and boilerplate.

Core Features & Use Cases

  • Type-safe, reactive persistence with Drift for SQLite and PostgreSQL
  • Guidance on schema migrations, code generation, and connection handling
  • Use cases include CLI tools, backend services, and server-side apps requiring durable storage
  • Provides practical setup and reference materials for Drift workflows

Quick Start

Install dependencies and scaffold a Drift-based database. Example commands:

  • dart pub add drift sqlite3 (for SQLite)
  • dart pub add drift postgres drift_postgres (for PostgreSQL)
  • Run code generation: dart run build_runner build
  • Create a minimal database class and open a connection as shown in the guide

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 type-safe SQLite persistence in a Dart backend service?▼

To set up type-safe SQLite persistence in a Dart backend, add the drift and sqlite3 packages, scaffold a database class, and run build_runner for code generation. This process provides reactive streams and robust schema migrations without manual SQL boilerplate.

What is Drift used for in Dart applications?▼

Drift is a Dart package used for type-safe, reactive persistent storage. It supports CLI tools, backend services, and server-side apps, enabling durable SQLite or PostgreSQL backends with schema migrations and reactive query streams.

Can I use PostgreSQL with Drift instead of SQLite?▼

Yes, you can use PostgreSQL with Drift instead of SQLite by adding the drift, postgres, and drift_postgres packages. This enables server-side Dart apps to leverage type-safe queries and schema migrations with an optional PostgreSQL backend.

How do I run code generation for a Drift database in Dart?▼

Run code generation for a Drift database by executing the dart run build_runner build command. This step generates the necessary type-safe query classes and boilerplate code required for database initialization and reactive streams.

What is the best way to handle database schema migrations in Dart?▼

The best way to handle database schema migrations in Dart is using Drift's built-in migration capabilities. It provides type-safe schema versioning and migration workflows for SQLite and PostgreSQL backends without losing existing application data.