status property

TextFieldState status
latefinal

MyUser.status field state.

Implementation

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

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

    final UserTextStatus? status = UserTextStatus.tryParse(s.text);

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