MouseCursorSession class Null safety

Manages the duration that a pointing device should display a specific mouse cursor.

While MouseCursor classes describe the kind of cursors, MouseCursorSession classes represents a continuous use of the cursor on a pointing device. The MouseCursorSession classes can be stateful. For example, a cursor that needs to load resources might want to set a temporary cursor first, then switch to the correct cursor after the load is completed.

A MouseCursorSession has the following lifecycle:

  • When a pointing device should start displaying a cursor, MouseTracker creates a session by calling MouseCursor.createSession on the target cursor, and stores it in a table associated with the device.
  • MouseTracker then immediately calls the session's activate, where the session should fetch resources and make system calls.
  • When the pointing device should start displaying a different cursor, MouseTracker calls dispose on this session. After dispose, this session will no longer be used in the future.

Constructors

MouseCursorSession(MouseCursor cursor, int device)
Create a session.

Properties

cursor MouseCursor
The cursor that created this session.
final
device int
The device ID of the pointing device.
final
hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

activate() Future<void>
Override this method to do the work of changing the cursor of the device.
protected">@protected
dispose() → void
Called when device stops displaying the cursor.
protected">@protected
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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