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,
  adapters: AppDatabaseAdapters(
    taskTagsToSql: (tags) => jsonEncode(tags),
    sqlValueToTaskTags: (value) => List<String>.from(jsonDecode(value as String)),
  ),
);

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