updatePhone method

Future<User> updatePhone({
  1. required String phone,
  2. required String password,
})

Update phone

Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the POST /account/verification/phone endpoint to send a confirmation SMS.

Implementation

Future<models.User> updatePhone(
    {required String phone, required String password}) async {
  const String apiPath = '/account/phone';

  final Map<String, dynamic> apiParams = {
    'phone': phone,
    'password': password,
  };

  final Map<String, String> apiHeaders = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.patch,
      path: apiPath, params: apiParams, headers: apiHeaders);

  return models.User.fromMap(res.data);
}