getStorage method

  1. @override
Future<BiometricStorageFile> getStorage(
  1. String name, {
  2. StorageFileInitOptions? options,
  3. bool forceInit = false,
  4. PromptInfo promptInfo = PromptInfo.defaultValues,
})
override

Retrieves the given biometric storage file. Each store is completely separated, and has it's own encryption and biometric lock. if forceInit is true, will throw an exception if the store was already created in this runtime.

Implementation

@override
Future<BiometricStorageFile> getStorage(
  String name, {
  StorageFileInitOptions? options,
  bool forceInit = false,
  PromptInfo promptInfo = PromptInfo.defaultValues,
}) async {
  try {
    final result = await _channel.invokeMethod<bool>(
      'init',
      {
        'name': name,
        'options': options?.toJson() ?? StorageFileInitOptions().toJson(),
        'forceInit': forceInit,
      },
    );
    _logger.finest('getting storage. was created: $result');
    return BiometricStorageFile(
      this,
      name,
      promptInfo,
    );
  } catch (e, stackTrace) {
    _logger.warning(
        'Error while initializing biometric storage.', e, stackTrace);
    rethrow;
  }
}