login method

  1. @override
Future<TelegramLoginResult> login()
override

Start the login flow.

Implementation

@override
Future<TelegramLoginResult> login() async {
  if (!_isConfigured) {
    throw TelegramLoginError.notConfigured();
  }

  try {
    final result = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      'login',
    );

    if (result == null) {
      throw TelegramLoginError.noAuthorizationCode();
    }

    return TelegramLoginResult.fromMap(Map<String, dynamic>.from(result));
  } on PlatformException catch (e) {
    throw _mapPlatformException(e);
  }
}