read method

  1. @override
Future<Uint8List?> read(
  1. String key, {
  2. BiometricPrompt? prompt,
})
override

The bytes under key, or null if absent. prompt is shown when the entry is biometric-protected. The caller owns the returned buffer: it is modifiable and should be overwritten once used.

Implementation

@override
Future<Uint8List?> read(String key, {BiometricPrompt? prompt}) async {
  _maybeFail(VaultOperation.read, key);
  final entry = _entries[key];
  if (entry == null) return null;
  if (entry.$2 != ProtectionLevel.standard) {
    prompts.add(prompt);
    if (!onBiometricPrompt(prompt)) throw const VaultUserCancelled();
  }
  return Uint8List.fromList(entry.$1);
}