exportCollectionToJson method

Future<void> exportCollectionToJson(
  1. Map<String, HarnCollection> collections
)

Implementation

Future<void> exportCollectionToJson(
    Map<String, HarnCollection> collections) async {
  final directory = await _getDirectory();
  for (final collectionName in collections.keys) {
    final collection = collections[collectionName]!;
    final collectionData = jsonEncode(collection.collection);
    final file = '$directory/$collectionName.json';
    await HarnDBPlatform.instance.write(collectionData, file);
  }
}