ofField static method

SuperFormState ofField(
  1. BuildContext context,
  2. String fieldName
)

Gets the closest SuperFormState instance.

If there is no SuperForm in scope, this will throw a TypeError exception in release builds, and throw a descriptive FlutterError in debug builds.

Use this version only when you are sure that the instance is available and you actually want an error when it doesn't.

This version will make the using widget update only when field with given name was modified.

See also:

  • of - non-null safe, not field specific version
  • ofMaybe - null safe, not field specific version
  • ofFieldMaybe - null safe, field specific version

Implementation

static SuperFormState ofField(BuildContext context, String fieldName) {
  return _SuperFormScope.ofField(context, fieldName);
}