name property

TextFieldState name
latefinal

MyUser.name field state.

Implementation

late final TextFieldState name = TextFieldState(
  text: myUser.value?.name?.val,
  onFocus: (s) async {
    s.error.value = null;

    if (s.text.isNotEmpty) {
      try {
        UserName(s.text);
      } on FormatException catch (_) {
        s.error.value = 'err_incorrect_input'.l10n;
        return;
      }
    }

    final UserName? name = UserName.tryParse(s.text);

    try {
      await updateUserName(name);
    } catch (_) {
      s.error.value = 'err_data_transfer'.l10n;
    }
  },
);