insertToken method

Future<Map<String, Map>> insertToken(
  1. AccessTokenResponse tknResp
)

Implementation

Future<Map<String, Map>> insertToken(AccessTokenResponse tknResp) async {
  final serTokens = await storage.read(key);
  final scopeKey = getScopeKey(tknResp.scope ?? []);
  var tokens = <String, Map>{};

  if (serTokens != null) {
    tokens = Map.from(jsonDecode(serTokens));
  }

  tokens[scopeKey] = tknResp.toMap();

  return tokens;
}