PointerPositionNotifier class

Notifier that tracks cursor position with automatic listener detection.

This notifier automatically optimizes performance by only updating position when there are active listeners. The optimization works by leveraging ValueNotifier.hasListeners to determine if position tracking should be active.

Performance Characteristics

  • Lazy Evaluation: Position updates only occur when widgets are listening
  • Automatic Optimization: No manual listener management required
  • Memory Efficient: Clears position data when not in use

Usage

This notifier is typically used internally by PointerPositionProvider and accessed through PointerPosition.of rather than directly.

Inheritance

Constructors

PointerPositionNotifier()

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldTrack bool
Whether tracking should be active based on listener presence.
no setter
value PointerPosition?
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
clearPosition() → void
Clears the current position.
dispose() → void
Discards any resources used by the object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited
updatePosition(Alignment position, Offset offset) → void
Updates position only if listeners exist.

Operators

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