update static method

Future<User> update(
  1. User user,
  2. Map map
)

Implementation

static Future<User> update(User user, Map map) async {
  if (map.containsKey("access_token")) {
    user.accessToken = map["access_token"].toString();
  }
  if (map.containsKey("id_token")) {
    user.token = map["id_token"].toString();
  }
  if (map.containsKey("refresh_token")) {
    user.refreshToken = map["refresh_token"].toString();
  }

  final prefs = await SharedPreferences.getInstance();
  await prefs.setString(AuthClient.keyToken, user.token);

  return user;
}