JsonTable constructor

JsonTable(
  1. String name, {
  2. String key = 'id',
  3. bool autoIncrementKey = false,
  4. List<List<String>> indexes = const [],
  5. List<List<String>> uniqueIndexes = const [],
  6. String? syncWith,
})

A table name keyed by key, with indexes over the named fields and uniqueIndexes (each index is named after its fields), synchronized with the remote syncWith when given.

Implementation

JsonTable(
  String name, {
  String key = 'id',
  bool autoIncrementKey = false,
  List<List<String>> indexes = const [],
  List<List<String>> uniqueIndexes = const [],
  String? syncWith,
}) : _table = DbTable<JsonRow>(
       name,
       key: key,
       fromJson: JsonRow.new,
       toJson: (row) => row.json,
       autoIncrement: autoIncrementKey,
       indexes: [
         for (final fields in indexes) Index(fields),
         for (final fields in uniqueIndexes) Index.unique(fields),
       ],
       syncWith: syncWith,
     );