Serialization

Use custom adapters when the public generated API should expose a domain type instead of the raw SQLite storage type.

CREATE TABLE task
(
    id INTEGER PRIMARY KEY NOT NULL,

    -- @@{ field=tags, adapter=custom, propertyType=List<String> }
    tags TEXT NOT NULL
);
final db = AppDatabase(
  path: path,
  taskAdapters: TaskAdapters(
    sqlColumnToTags: (value) => List<String>.from(jsonDecode(value)),
    tagsToSqlColumn: (tags) => jsonEncode(tags),
  ),
);

Prefer stable serialized values for enums and timestamps. For absolute time, store RFC3339 text with an explicit zone instead of locale-specific strings.