initState method

  1. @override
  2. @mustCallSuper
void initState ()
@mustCallSuper, override

Initializes the input field by automatically registering itself to an InputForm ancestor (if there is one).

Enables the field by first checking parameter enable. If not set then checks parameter enable at the InputForm ancestor. If no ancestor or not set then defaults to true.

Sets initially displayed value by using parameter initialValue. If not set then uses value from InputForm ancestor at parameter path. If no ancestor or not set then defaults to a widget specific value.


void initState() {
  _formState = context.findAncestorStateOfType<InputFormState>();
  dynamic valueLoaded = widget.initialValue ??
      InputUtils.readJson(, widget.path) ??
      InputUtils.readJson(_formState?.widget?.map, widget.path);
  _initialValue = InputUtils.convertToType(T, valueLoaded);
  value = _initialValue;