updateUser method

Future<UserModel> updateUser(
  1. String userId,
  2. UserModel user
)

Updates a user's profile.

Makes a PUT /user/:userId request.

userId is the ID of the user to update. user contains the updated user data.

Returns the updated UserModel.

Throws DioError on failure.

Implementation

Future<UserModel> updateUser(String userId, UserModel user) async {
  final response = await client.dio.put(
    ApiEndpoints.updateUser(userId),
    data: user.toUpdateJson(),
  );
  return UserModel.fromJson(response.data as Map<String, dynamic>);
}