updateEmail static method
update current user's email address.
Implementation
static Future<AuthResult> updateEmail(String email, String emailCode,
[String? oldEmail, String? oldEmailCode]) async {
Map map = {};
map.putIfAbsent('email', () => email);
map.putIfAbsent('emailCode', () => emailCode);
if (oldEmail != null && oldEmailCode != null) {
map.putIfAbsent('oldEmail', () => oldEmail);
map.putIfAbsent('oldEmailCode', () => oldEmailCode);
}
final Result result =
await post('/api/v2/users/email/update', jsonEncode(map));
AuthResult authResult = AuthResult(result);
if (result.code == 200) {
authResult.user = await createUser(result);
}
return authResult;
}