registerByPhoneCode static method

Future<AuthResult> registerByPhoneCode(
  1. String phone,
  2. String passCode, [
  3. String? phoneCountryCode,
  4. RegisterOptions? options,
])

register a new user by phone number and an SMS verification code.

Implementation

static Future<AuthResult> registerByPhoneCode(String phone, String passCode,
    [String? phoneCountryCode, RegisterOptions? options]) async {
  Map map = {};
  map.putIfAbsent('phone', () => phone);
  map.putIfAbsent('passCode', () => passCode);
  if (phoneCountryCode != null) {
    map.putIfAbsent('phoneCountryCode', () => phoneCountryCode);
  }
  var body = {
    'connection': 'PASSCODE',
    'passCodePayload': map,
  };

  var jsonBody = jsonEncode(body);
  if (options != null) {
    jsonBody = jsonEncode(options.setValues(body));
  }
  final Result result = await post('/api/v3/signup', jsonBody);
  // AuthResult authResult = AuthResult(result);
  // authResult.user = await createUser(result);
  return AuthResult(result);
}