sendRegistrationOtp method

Future<Map<String, dynamic>> sendRegistrationOtp(
  1. String phone
)

Implementation

Future<Map<String, dynamic>> sendRegistrationOtp(String phone) async {
  const query = r'''
    mutation SendRegistrationOTP($phoneNumber: String!, $productToken: String!) {
      sendRegistrationOtp(phoneNumber: $phoneNumber, productToken: $productToken) {
        success
        message
        expiresIn
      }
    }
  ''';

  final formattedPhone = _normalizePhone(phone);

  final res = await _api.graphql(query, {
    'phoneNumber': formattedPhone,
    'productToken': productToken,
  });

  return Map<String, dynamic>.from(
    res['sendRegistrationOtp'] ?? {'success': false, 'message': 'Unexpected response'},
  );
}