refreshToken method Null safety

Future<OAuthToken> refreshToken(
  1. {required OAuthToken oldToken,
  2. String? redirectUri,
  3. String? appKey}
)

기존 토큰(oldToken)을 갱신합니다.

Implementation

Future<OAuthToken> refreshToken({
  required OAuthToken oldToken,
  String? redirectUri,
  String? appKey,
}) async {
  final data = {
    Constants.refreshToken: oldToken.refreshToken,
    Constants.grantType: Constants.refreshToken,
    Constants.clientId: appKey ?? KakaoSdk.platformAppKey,
    Constants.redirectUri: redirectUri ?? await _platformRedirectUri(),
    ...await _platformData()
  };
  final newToken = await _issueAccessToken(data, oldToken: oldToken);
  await _tokenManagerProvider.manager.setToken(newToken);
  return newToken;
}