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 {
  var userId = id;
  if (userId == null) return false;

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

  userName = newUserName;
  return true;
}