FocusHistoryManager class

Focus history manager using stack structure for focus memory restoration.

Each DpadNavigator has its own FocusHistoryManager instance, ensuring focus history is isolated per navigator scope.

Memory Management: Automatically cleans up disposed FocusNodes to prevent memory leaks. Call cleanup periodically or when widgets are destroyed.

Constructors

FocusHistoryManager({int maxSize = 20})
Creates a new focus history manager.

Properties

hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Whether the history stack is empty.
no setter
length int
The number of entries in the history stack.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cleanup() → void
Manual cleanup method to free memory from disposed FocusNodes.
clear() → void
Clears all focus history entries.
getCurrent() FocusHistoryEntry?
Gets the current focus entry.
getHistory() List<FocusHistoryEntry>
Gets the complete history as a read-only list.
getLastFocusInRegion(String region) FocusHistoryEntry?
Gets the last focus entry for a specific region.
getLastFocusInRoute(String routeName) FocusHistoryEntry?
Gets the last focus entry for a specific route.
getLastPoppedEntry() FocusHistoryEntry?
Gets the last popped focus entry.
getPrevious() FocusHistoryEntry?
Gets the previous focus entry.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop() FocusHistoryEntry?
Pops the current focus entry from the stack.
push(FocusHistoryEntry entry) → void
Pushes focus entry to the history stack.
removeInvalidEntries() int
Removes invalid entries from the history stack.
setMaxSize(int size) → void
Sets the maximum number of history entries to keep.
toString() String
A string representation of this object.
inherited

Operators

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