exportDatabase function
Future<Map<String, Object?> >
exportDatabase(
- DatabaseClient client, {
- List<
String> ? storeNames, - SembastExportOptions? options,
Return the data in an exported format that (can be JSONified).
An optional storeNames can specify the list of stores to export. If null
All stores are exported.
See exportDatabaseLines for client and options.
Implementation
Future<Map<String, Object?>> exportDatabase(
DatabaseClient client, {
List<String>? storeNames,
SembastExportOptions? options,
}) async {
var export = newModel();
final storesExport = <Map<String, Object?>>[];
await _exportDatabase(
client,
typeEncoding: options?.typeEncoding,
exportMeta: (Model map) {
export.addAll(map);
},
exportStore: (Model map) {
storesExport.add(map);
},
storeNames: options?.storeNames ?? storeNames,
);
if (storesExport.isNotEmpty) {
export[_stores] = storesExport;
}
return export;
}