getStorage method

  1. @override
Future<BiometricStorageFile> getStorage(
  1. String name, {
  2. StorageFileInitOptions? options,
  3. bool forceInit = false,
  4. AndroidPromptInfo androidPromptInfo = AndroidPromptInfo.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,
  AndroidPromptInfo androidPromptInfo = AndroidPromptInfo.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,
      androidPromptInfo,
    );
  } catch (e, stackTrace) {
    _logger.warning(
        'Error while initializing biometric storage.', e, stackTrace);
    rethrow;
  }
}