flutter-drift-androidlisted
Install: claude install-skill AkashPriyadarshii/cookbook
# Flutter, Drift & Android Toolchain Lessons
Lessons from building an offline-first life tracker (Flutter + Drift + Android 16).
Each one broke a real build or codegen run.
## 1. Drift column named `text` silently breaks codegen
Naming a Drift schema column `TextColumn get text => text()();` collides with
Drift's own `Table.text()` DSL builder method. `build_runner` produces an empty
`database.g.dart` stub with no compiler error, causing a cascade of missing-class
failures across the entire app.
**Fix:** name the column `note`, `content`, or `body` — never `text`:
```dart
// WRONG: collides with Table.text()
TextColumn get text => text()();
// CORRECT:
TextColumn get note => text()();
```
**Check:** `grep -rn "TextColumn get text" lib/db/` must return zero results.
## 2. Drift query builders collide with `flutter_test` and widgets
Importing `package:drift/drift.dart` in test files exports `isNull` and `isNotNull`,
which collide with `package:matcher/matcher.dart` matchers. In UI files, Drift's
`Column` and `Table` collide with Flutter layout widgets.
**Fix:** hide colliding symbols explicitly on import:
```dart
// In test files:
import 'package:drift/drift.dart' hide isNull, isNotNull;
// In widget / UI files:
import 'package:drift/drift.dart' hide Column, Table;
```
**Check:** `flutter analyze` flags `ambiguous_import` immediately on collision.
## 3. Legacy plugin hardcodes `compileSdk 34` vs AGP 36 requirement
Older plugin versions (e.g. `file_picker` ^8.x) h