setInitialValue method
void
setInitialValue({
- TEntity? value,
- TEntity getterValue()?,
inherited
Implementation
void setInitialValue({
TEntity? value,
TEntity Function()? getterValue,
}) {
assert(!(value != null && getterValue != null),
"use \"value\" or \"getterValue\"");
final getter = getterValue ?? () => value!;
if (this._reactionOnValueGetterDisposer != null) {
this._reactionOnValueGetterDisposer!();
}
this._reactionOnValueGetterDisposer = reaction(
(_) => getter(),
(TEntity initialValue) {
this.inProcessing = true;
if (this._reactionOnInternalValueDisposer != null) {
this._reactionOnInternalValueDisposer!();
}
this._internalValue = initialValue;
this.serverErrors = [];
this._reactionOnInternalValueDisposer = reaction(
(_) => this._internalValue,
(_) {
runInAction(() => this._onChangeValue(this._internalValue!));
this._isDirty = true;
this.serverErrors = [];
this._checkInternalValue(true);
},
);
this._checkInternalValue(this._isInitialized
? this._callSetterOnReinitialize
: this._callSetterOnInitialize);
this._isInitialized = true;
},
fireImmediately: true,
);
}