dart-drift

Implement type-safe SQLite and PostgreSQL storage in Dart with drift.

21|16|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/xiaoliwanshui/cool-admin-flutter --skill dart-drift-xiaoliwanshui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dart-drift
Source: https://github.com/xiaoliwanshui/cool-admin-flutter/tree/main/.trae/skills/dart-drift
Command: npx skills add https://github.com/xiaoliwanshui/cool-admin-flutter --skill dart-drift-xiaoliwanshui

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Drift provides a complete guide to implementing robust, type-safe persistent storage in Dart applications (CLI, server-side, non-Flutter) using the drift library, including setup for SQLite and PostgreSQL, migrations, and reactive streams.

Core Features & Use Cases

  • Type-safe queries and reactive data persistence across Dart environments.
  • SQLite and PostgreSQL support with guidance on local, server, and cross-platform setups.
  • Code generation and migrations workflows using drift_dev and build_runner for maintainable schemas.
  • Real-world patterns for tables, queries, writes, and streaming data in non-UI Dart apps.

Quick Start

Create a Drift database class and open a SQLite or PostgreSQL connection to begin using drift in your Dart project.

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 storage in a Dart CLI or server application?

To set up type-safe SQLite storage in Dart, create a Drift database class and open a SQLite connection using sqlite3. You then define tables and use drift_dev with build_runner for code generation, ensuring type-safe queries and persistent storage in non-Flutter environments.

Can I use Drift with PostgreSQL in non-Flutter Dart apps?

Yes, Drift supports PostgreSQL integration in non-Flutter Dart apps. You can configure a PostgreSQL connection using drift_postgres, enabling type-safe queries, writes, and reactive streams for server-side persistent storage.

What is the best way to handle database migrations with Drift in Dart?

The best way to handle Drift migrations is by using code generation with drift_dev and build_runner. This workflow ensures maintainable database schemas and allows you to apply structured migrations seamlessly across your local SQLite or PostgreSQL environments.

Does Drift support reactive streams for server-side Dart applications?

Yes, Drift supports reactive streams for server-side Dart applications. It provides real-world patterns for streaming data, allowing your CLI or server app to react dynamically to database changes through type-safe queries.

How do I perform type-safe queries and writes using Drift in Dart?

You perform type-safe queries and writes in Drift by defining table classes and generating boilerplate code with build_runner. This process creates a type-safe API to interact with your SQLite or PostgreSQL database without manual SQL string writing.