fromJson2 static method Null safety

OAuthToken fromJson2(
  1. Map<String, dynamic> json
)

Implementation

static OAuthToken fromJson2(Map<String, dynamic> json) {
  if (json.containsKey('refresh_token_expires_in')) {
    json['refresh_token_expires_at'] = DateTime.now()
        .toUtc()
        .add(Duration(seconds: json['refresh_token_expires_in']));
  }
  if (json.containsKey('expires_in')) {
    json['access_token_expires_at'] =
        DateTime.now().toUtc().add(Duration(seconds: json['expires_in']));
  }
  return OAuthToken.fromJson(json);
}