read static method
读取指定键的值
key 指定要读取的键名称。
返回值:
- 读取成功时,返回对应 key 的 value(字符串),
- 若 key 不存在或读取失败,返回 null。
示例:
String? value = await KeychainUtil.read(key: 'my_key');
Implementation
static Future<String?> read({required String key}) async {
try {
return await storage.read(key: key);
} catch (e) {
Logger.trace('Failed to read keychain: $e');
return null;
}
}