login method

Future<PendingOtpVerification> login(
  1. dynamic phone, {
  2. dynamic params,
})

Login using otp phone combination.

Optional params map is available.

Implementation

Future<PendingOtpVerification> login(phone, {params}) async {
  final result = await _channel.invokeMapMethod<String, dynamic>(
    OtpMethods.login.name,
    {
      'phone': phone,
      'parameters': params ?? {},
    },
  ).catchError((error) {
    debugPrint('error');
    return throw GigyaResponse.fromJson(decodeError(error));
  }).timeout(Duration(minutes: 1), onTimeout: () {
    debugPrint('A timeout that was defined in the request is reached');
    return timeoutError();
  });
  return PendingOtpVerification(_channel, result ?? {});
}