importCollection method

Future<void> importCollection(
  1. String filePath
)

Implementation

Future<void> importCollection(String filePath) async {
  final jsonData = await _harnFile.readFile(filePath);
  final collectionsData = jsonDecode(jsonData) as Map<String, dynamic>;
  for (final entry in collectionsData.entries) {
    final collectionName = entry.key;
    final collectionData = entry.value;
    final collection = HarnCollection(collectionName, collectionData);
    _collections[collectionName] = collection;
    _initialData[collectionName] = collectionData;
    await _harnFile.write(collectionName, jsonData);
  }
}