updatePhone static method
2230 same phone number 1320004 phone already bind
Implementation
static Future<AuthResult> updatePhone(String phone, String phoneCode,
[String? oldPhone,
String? oldPhoneCode,
String? phoneCountryCode,
String? oldPhoneCountryCode]) async {
Map map = {};
map.putIfAbsent('phone', () => phone);
map.putIfAbsent('phoneCode', () => phoneCode);
if (oldPhone != null && oldPhoneCode != null) {
map.putIfAbsent('oldPhone', () => oldPhone);
map.putIfAbsent('oldPhoneCode', () => oldPhoneCode);
}
if (phoneCountryCode != null) {
map.putIfAbsent('phoneCountryCode', () => phoneCountryCode);
}
if (oldPhoneCountryCode != null) {
map.putIfAbsent('oldPhoneCountryCode', () => oldPhoneCountryCode);
}
final Result result =
await post('/api/v2/users/phone/update', jsonEncode(map));
AuthResult authResult = AuthResult(result);
if (result.code == 200) {
authResult.user = await createUser(result);
}
return authResult;
}