login static method

Future<AuthToken> login()

카카오 SDK를 통해 카카오에 로그인을 요청합니다.

카카오톡 앱 설치 여부에 따라 카카오톡으로 이동 또는 웹으로 이동하여 로그인을 진행합니다. 로그인 요청이 성공하면 토큰 발급을 요청하고 토큰 발급이 완료되면 로그인이 완료됩니다.

로그인 처리 중 SDK 오류가 발생한 경우 AuthFailureException을 throw 합니다. SDK 오류 이외의 예외는 Exception 객체를 rethrow 합니다. 정상적으로 처리가 완료되면 발급된 토큰 정보인 AuthToken 객체를 반환합니다.

Implementation

static Future<AuthToken> login() async {
  try {
    final data = await _channel.invokeMethod('login');
    return AuthToken.fromJson(Map<String, dynamic>.from(data));
  } on PlatformException catch (error) {
    throw AuthFailureException(error.code.authFailureReason, error.message);
  } catch (error) {
    rethrow;
  }
}