Created
November 22, 2020 17:50
-
-
Save utkarsh-UK/2163dcb185eea7d010c7a07232351e06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<String> retrieveUserToken() async { | |
try { | |
final secureKey = await secureStorage.read(key: SECURE_STORAGE_KEY); | |
List<int> encryptionKey = (json.decode(secureKey) as List<dynamic>).cast<int>(); | |
final encryptedBox = await hive.openBox(BOX_NAME, encryptionKey: encryptionKey); | |
String token = encryptedBox.get('token'); | |
encryptedBox.close(); | |
return token; | |
} catch (e) { | |
throw CacheException(message: e.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment