createPhoneAccount static method
Returns a map with the following keys: if there was no error:
token:Tokenfrom Appwrite if there was an error:error:trueif there was an errortype:errorif there was an errormessage:Stringcontaining the error messagecode:intcontaining the error code
Implementation
static Future<Map<String, dynamic>> createPhoneAccount({
/// Phone number of the user to signup
required String phone,
/// Connect the phone number to an existing account
bool connectMode = false,
}) async {
try {
// if (connectMode) {
// if (isLoggedIn) {
// final models.Token token = await _account.createPhoneToken(
// userId: _session!.userId,
// phone: phone,
// );
// return token.toMap();
// } else {
// throw AppwriteException(
// 'You need to be logged in to connect a phone number',
// 401,
// 'No session found',
// null,
// );
// }
// }
final models.Token token = await _account.createPhoneToken(
userId: ID.unique(),
phone: phone,
);
return token.toMap();
} on AppwriteException catch (e) {
return {
'error': true,
'type': e.type,
'message': e.message,
'code': e.code,
};
}
}