updateUserName method

  1. @override
Future<void> updateUserName(
  1. UserName? name
)
override

Updates MyUser.name field for the authenticated MyUser.

Resets MyUser.name field to null for the authenticated MyUser if the provided name is null.

Implementation

@override
Future<void> updateUserName(UserName? name) async {
  Log.debug('updateUserName($name)', '$runtimeType');

  await _debounce(
    field: MyUserField.name,
    current: () => myUser.value?.name,
    saved: () async => (await _active)?.value.name,
    value: name,
    mutation: (v, _) => _graphQlProvider.updateUserName(v),
    update: (v, _) => myUser.update((u) => u?.name = v),
  );
}