updateUser method

  1. @override
Future<User> updateUser(
  1. User user
)
override

Sends the user to the server and returns the updated User from the server.

Implementation

@override
Future<User> updateUser(User user) async {
  var response = await apiService.callFunction(
    function: "local_lbplanner_user_update_user",
    token: userToken.lbPlannerApiToken,
    body: {
      "colorblindness": user.colorBlindnessString,
      "lang": user.language,
      "theme": user.themeName,
      "displaytaskcount": user.displayTaskCountInt,
    },
  );

  if (response.failed) {
    throw Exception("Failed to update user");
  }

  return User.fromJson(response.expectSingle());
}