signUpOrLoginByMobilePhone static method
Signs up or signs in a LCUser
with their mobile
number and verification code
.
Implementation
static Future<LCUser> signUpOrLoginByMobilePhone(
String mobile, String code) async {
if (isNullOrEmpty(mobile)) {
throw ArgumentError.notNull('mobile');
}
if (isNullOrEmpty(code)) {
throw ArgumentError.notNull('code');
}
Map<String, dynamic> response = await LeanCloud._httpClient.post(
'usersByMobilePhone',
data: {'mobilePhoneNumber': mobile, 'smsCode': code});
_LCObjectData objectData = _LCObjectData.decode(response);
_currentUser = LCUser._fromObjectData(objectData);
await _saveToLocal();
return _currentUser!;
}