loadTokenFromCache<T extends Token> method

Future<T> loadTokenFromCache<T extends Token>()

Implementation

Future<T> loadTokenFromCache<T extends Token>() async {
  var json = await _secureStorage.read(key: _tokenIdentifier);
  if (json == null) return emptyToken as FutureOr<T>;
  try {
    var data = jsonDecode(json);
    return _getTokenFromMap<T>(data) as FutureOr<T>;
  } catch (exception) {
    print(exception);
    return emptyToken as FutureOr<T>;
  }
}