of method Null safety

AutofillGroupState? of(
  1. BuildContext context
)

Returns the closest AutofillGroupState which encloses the given context.

An AutofillGroupState can be used to register an AutofillClient when it enters this AutofillGroup (for example, when an EditableText is mounted or reparented onto the AutofillGroup's subtree), and unregister an AutofillClient when it exits (for example, when an EditableText gets unmounted or reparented out of the AutofillGroup's subtree).

The AutofillGroupState class also provides an AutofillGroupState.attach method that can be called by TextInputClients that support autofill, instead of TextInput.attach, to create a TextInputConnection to interact with the platform's text input system.

See also:

Implementation

static AutofillGroupState? of(BuildContext context) {
  final _AutofillScope? scope = context.dependOnInheritedWidgetOfExactType<_AutofillScope>();
  return scope?._scope;
}