get method

  1. @override
Future get(
  1. String key
)
override

Get from local storage

Implementation

@override
/// Get from local storage
Future<dynamic> get(String key) async {
  final path = await _storagePath;
  File file = File(_keyPath(path, key));

  if (await file.exists()) {
    String contents = await file.readAsString();
    if (mode == EncryptionMode.fernet && encryptionKey != null) {
      return fernet.decryptFernet(contents, encryptionKey!);
    } else if (mode == EncryptionMode.aes && encryptionKey != null) {
      return aes.decryptAES(contents, encryptionKey!);
    }
    return contents;
  }
  return null;
}