You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class ProfileNameForm extends ControlsCollection {
final FormControl<String> fullName;
ProfileNameForm({required this.fullName});
@override
Iterable<AbstractControl> allFields() => [fullName];
}
_ProfileNameStore(this._profileStore) {
form = FormGroup(
ProfileNameForm(
fullName: FormControl(
value: _profileStore.profile?.fullName
У меня есть вот такая простая форма и value может оказаться null.
Автосгенерённый код это допускает, но проблема что если я попробую обратиться вот так final offset = store.form.controls.fullName.value.length;
Здесь уже всё должно быть non-nullable и во время исполнения я получу ошибку:
MobXCaughtException: Null check operator used on a null value
computed.dart in Computed.value at line 91 within mobx
form-control.g.dart in _$FormControl.value at line 42 within flutter_mobx_form_validation_kit
The text was updated successfully, but these errors were encountered:
Добрый день.
Mobx не оборачивает классы (в глубину), только интерфейсы.
Как следствие, нужно просто вместо class использовать interface и, по идее, всё будет работать.
У меня есть вот такая простая форма и value может оказаться null.
Автосгенерённый код это допускает, но проблема что если я попробую обратиться вот так
final offset = store.form.controls.fullName.value.length;
Здесь уже всё должно быть non-nullable и во время исполнения я получу ошибку:
MobXCaughtException: Null check operator used on a null value
computed.dart in Computed.value at line 91 within mobx
form-control.g.dart in _$FormControl.value at line 42 within flutter_mobx_form_validation_kit
The text was updated successfully, but these errors were encountered: