AuthorizationCodeResponse.fromJson constructor

AuthorizationCodeResponse.fromJson(
  1. Map<String, dynamic> json
)

Creates an instance of AuthorizationCodeResponse from a JSON map.

Implementation

factory AuthorizationCodeResponse.fromJson(Map<String, dynamic> json) =>
    AuthorizationCodeResponse(
      accessToken: json['access_token'],
      tokenType: json['token_type'],
      expiresIn: json['expires_in'],
      scope: (json['scope'] as String)
          .split(' ')
          .map(
            (String e) => BattleNetScope.values.firstWhere(
              (BattleNetScope element) => element.name == e,
            ),
          )
          .toList(),
      sub: json['sub'],
      idToken: json['id_token'],
    );