authorizeWithTalk method Null safety

Future<String> authorizeWithTalk(
  1. {String? clientId,
  2. String? redirectUri,
  3. List<Prompt>? prompts,
  4. List<String>? channelPublicId,
  5. List<String>? serviceTerms,
  6. String? state,
  7. String? codeVerifier,
  8. String? nonce,
  9. String? stateToken,
  10. bool webPopupLogin = false}
)

사용자가 앱에 로그인할 수 있도록 사용자의 디바이스에 설치된 카카오톡을 통해 인가 코드를 요청하는 함수입니다. 인가 코드를 받을 수 있는 서버 개발이 필요합니다.

Implementation

Future<String> authorizeWithTalk({
  String? clientId,
  String? redirectUri,
  List<Prompt>? prompts,
  List<String>? channelPublicId,
  List<String>? serviceTerms,
  String? state,
  String? codeVerifier,
  String? nonce,
  String? stateToken,
  bool webPopupLogin = false,
}) async {
  try {
    final webStateToken =
        stateToken ?? (kIsWeb ? generateRandomString(20) : null);

    var response = await _openKakaoTalk(
      clientId ?? _platformKey(),
      redirectUri ?? "kakao${_platformKey()}://oauth",
      channelPublicId,
      serviceTerms,
      codeVerifier,
      prompts,
      state,
      nonce,
      stateToken: webStateToken,
      webPopupLogin: webPopupLogin,
    );

    if (kIsWeb) {
      if (webPopupLogin) {
        return response;
      }
      var params = {
        'redirect_uri': redirectUri,
        'code': response,
        'state': webStateToken
      };
      await _channel.invokeMethod('redirectForEasyLogin', params);
      return response;
    }
    return _parseCode(response);
  } catch (e) {
    SdkLog.e(e);
    rethrow;
  }
}