FocusAttachment class

An attachment point for a FocusNode.

Once created, a FocusNode must be attached to the widget tree by its host StatefulWidget via a FocusAttachment object. FocusAttachments are owned by the StatefulWidget that hosts a FocusNode or FocusScopeNode. There can be multiple FocusAttachments for each FocusNode, but the node will only ever be attached to one of them at a time.

This attachment is created by calling FocusNode.attach, usually from the host widget's State.initState method. If the widget is updated to have a different focus node, then the new node needs to be attached in State.didUpdateWidget, after calling detach on the previous FocusAttachment. Once detached, the attachment is defunct and will no longer make changes to the FocusNode through reparent.

Without these attachment points, it would be possible for a focus node to simultaneously be attached to more than one part of the widget tree during the build stage.

Properties

isAttached bool
Returns true if the associated node is attached to this attachment. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

detach() → void
Detaches the FocusNode this attachment point is associated with from the focus tree, and disconnects it from this attachment point. [...]
reparent({FocusNode parent }) → void
Ensures that the FocusNode attached at this attachment point has the proper parent node, changing it if necessary. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited