manual method

Future<bool> manual(
  1. File inputFile
)

Import a store from a specified inputFile

It is recommended to use withGUI instead. This is only provided for finer control.

The output specifies whether the import was successful or unsuccessful.

Implementation

Future<bool> manual(File inputFile) async {
  Future<bool> error(StoreManagement storeManagement) async {
    await storeManagement.deleteAsync();
    return false;
  }

  final String storeName =
      p.basenameWithoutExtension(inputFile.absolute.path);
  final StoreManagement storeManagement =
      StoreDirectory(_rootDirectory, storeName, autoCreate: false).manage;

  if (!await compute(_import, {
    _rootDirectory.access.stores > storeName:
        await File(inputFile.absolute.path).readAsBytes(),
  })) return error(storeManagement);

  if (await storeManagement.readyAsync) return true;
  return error(storeManagement);
}