changeUserName method

Future<bool> changeUserName(
  1. Session session,
  2. String newUserName
)

Updates the name of this user, returns true if successful.

Implementation

Future<bool> changeUserName(Session session, String newUserName) async {
  if (id == null) return false;

  var updatedUser = await Users.changeUserName(session, id!, newUserName);
  if (updatedUser == null) return false;

  userName = newUserName;
  return true;
}