exportTable method

Map<String, Object?>? exportTable(
  1. String table
)

table's rows, their rowids and the next rowid, as data a store that persists this database somewhere else can keep -- or null when there is no such table. importTable reads it back.

Implementation

Map<String, Object?>? exportTable(String table) {
  final _MemoryTable? held = _tables[table];
  if (held == null) return null;
  return <String, Object?>{
    'next': held._nextRowid,
    'rows': <Object?>[
      for (final _MemoryRow row in held.rows)
        <String, Object?>{
          'rowid': row.rowid,
          'values': Map<String, Object?>.of(row.values),
        },
    ],
  };
}