FocusNode class

A focusable point in the focus tree that notifies listeners when its focus state changes.

Inheritance
Implementers

Constructors

FocusNode({String? debugLabel, FocusOnKeyEvent? onKeyEvent, bool canRequestFocus = true})
Configures a detached node with optional diagnostics and key handling.

Properties

canRequestFocus bool
Whether the focus manager may assign primary focus to this node.
getter/setter pair
children Iterable<FocusNode>
Live read-only view of direct focus children in insertion order.
no setter
debugLabel String?
Optional label used only for diagnostics.
final
hasFocus bool
Whether this node itself currently holds focus.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether at least one listener is registered.
no setterinherited
hasPrimaryFocus bool
Whether this node is its manager's current primary focus.
no setter
isAttached bool
Whether this node is registered with a FocusManager.
no setter
onKeyEvent FocusOnKeyEvent?
Handler consulted while a key event bubbles through this node.
getter/setter pair
parent FocusNode?
Direct parent in the focus tree, or null when none is assigned.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register listener for future notifications.
inherited
dispose() → void
Detaches this node before releasing its notifier listeners.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Notifies all registered listeners using a stable snapshot.
inherited
removeListener(VoidCallback listener) → void
Remove one registration of listener.
inherited
requestFocus() → void
Requests primary focus, throwing unless this node is attached to a manager.
toString() String
A string representation of this object.
inherited
unfocus({bool descendants = false}) → void
Unfocuses this node or its currently focused descendant; descendants also recurses through every child subtree. Unattached nodes are a no-op.

Operators

operator ==(Object other) bool
The equality operator.
inherited