drift_dev 는 Flutter 애플리케이션에서 데이터베이스 관리를 간소화하기 위해 드리프트 패키지의 개발 의존성으로 코드 생성 도구 및 유틸리티를 제공합니다. SQL 스키마 정의에서 효율적이고 타입 안전한 Dart 코드를 생성하는 생성기가 포함되어 있으며, 반복 코드를 줄이고 런타임 오류를 최소화합니다. 로컬 데이터베이스 작업에 drift 를 사용하는 개발자를 위한 것으로, 모델 생성 및 마이그레이션 처리와 같은 반복 작업을 자동화하여 생산성을 향상시킵니다. 이 도구는 Flutter의 빌드 시스템과 원활하게 통합되어 개발 중 빠른 반복을 가능하게 합니다.
사용 사례
타입 안전한 데이터베이스 모델 생성
마이그레이션 스크립트 자동화
SQL 스키마 통합 간소화
실시간 데이터베이스 업데이트 활성화
오프라인 우선 앱 개발 지원
주요 기능
SQL 스키마에서 코드 생성
형 안전한 데이터베이스 접근
Flutter 빌드 시스템과의 원활한 통합
자동 마이그레이션 처리
실시간 데이터 동기화 지원
적합한 대상
로컬 데이터베이스용으로 드리프트를 사용하는 플러터 개발자
오프라인 우선 기능을 필요로 하는 앱
타입 안정성과 코드 품질을 우선시하는 팀
보일러플레이트를 줄이려는 개발자
복잡한 데이터베이스 스키마를 가진 프로젝트
고려 사항
drift를 종속성으로 필요로 합니다
Flutter 프로젝트에만 제한됨
런타임 기능 없음
개발 전용으로 사용해야 합니다
코드 생성을 위해 build_runner에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Drift
Core
Generator
Drift is a reactive persistence library for Flutter and Dart, built on top of
SQLite.
Drift is:
Flexible: Drift lets you write queries in both SQL and Dart,
providing fluent apis for both languages. You can filter and order results
or use joins to run queries on multiple tables. You can even use complex
SQL features like WITH and WINDOW clauses.
🔥 Feature rich: Drift has builtin support for transactions, schema
migrations, complex filters and expressions, batched updates and joins. We
even have a builtin IDE for SQL!
📦 Modular: Thanks to builtin support for daos and imports in SQL files, drift helps you keep your database code simple.
🛡️ Safe: Drift generates type-safe code based on your tables and queries. If you make a mistake in your queries, drift will find it at compile time and
provide helpful and descriptive lints.
⚡ Fast: Even though drift lets you write powerful queries, it can keep
up with the performance of key-value stores like shared preferences and Hive. Drift is the only major persistence library with builtin threading support, allowing you to run database code across isolates with zero additional effort.
Reactive: Turn any SQL query into an auto-updating stream! This includes complex queries across many tables.
⚙️ Cross-Platform support: Drift works on Android, iOS, macOS, Windows, Linux and the web. This template is a Flutter todo app that works on all platforms.
🗡️ Battle tested and production ready: Drift is stable and well tested with a wide range of unit and integration tests. It powers production Flutter apps.
This repository contains a number of packages making up the drift project, most
notably:
drift: The main runtime for drift, which provides most APIs.
drift_dev: The compiler for drift tables, databases and daos. It
also contains a fully-featured SQL IDE for the Dart analyzer.
sqlparser: A SQL parser and static analyzer, written in pure Dart. This package can be used without drift to perform analysis on SQL statements.
It's on pub at
.
We use melos to manage the different packages
in this repository.
You can install it with dart pub global activate melos. To activate it in this
repository, run dart pub get in this directory followed by melos bootstrap.