setPassword method

Future<bool> setPassword(
  1. String phoneNumber,
  2. String password
)

Attempts to set or reset a user's password.

This method is typically used for initial password setup or password reset. On success, it returns true. On failure, it sets an error message.

Returns true if the password is set successfully, false otherwise. Note: This method currently does not save new auth data as it's for setting a password, not logging in.

Implementation

Future<bool> setPassword(String phoneNumber, String password) async {
   _setLoading(true);
   _clearError();
   try {
     final response = await _apiService.setPassword(phoneNumber, password);
     return true;
   } catch (e) {
     _setError(parseApiError(e.toString()));
     return false;
   } finally {
     _setLoading(false);
   }
 }