NativeMouseCursorWeb class
Web implementation: each cursor becomes a url(data:image/png;base64,…) x y
CSS cursor value, applied to the Flutter view's host element(s) on
setCursor.
The bitmap handed to us is already logical-size and ≤128 px (the framework
side caps it for the browser), with hotX/hotY in the bitmap's own pixels
and devicePixelRatio == 1, so the CSS hotspot is used as-is.
We set the cursor on several candidate view elements because which element actually carries the cursor varies across Flutter web engine versions.
- Inheritance
-
- Object
- PlatformInterface
- NativeMouseCursorPlatform
- NativeMouseCursorWeb
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createCursor(
{required String key, required Uint8List pngBytes, required int width, required int height, required int hotX, required int hotY, required double devicePixelRatio}) → Future< void> -
Register a cursor bitmap (
pngBytes,width×heightdevice pixels) underkey, with hotspothotX/hotY(device pixels) and sourcedevicePixelRatioso the OS sizes it in logical points.override -
createCursorWeb(
{required String key, required Uint8List lo, required Uint8List hi, required double density, required int hotX, required int hotY}) → Future< void> -
Web only: register a cursor from a low-res (
lo, 1×, CSS-sized) and a high-res (hi) PNG so HiDPI browsers render it crisply via CSSimage-set.densityis the high-res bitmap's resolution multiplier;hotX/hotYare in CSS pixels. A no-op off the web.override -
deleteCursor(
String key) → Future< void> -
Forget the cursor registered under
key.override -
isSupported(
) → Future< bool> -
Whether this host can show a true native OS cursor. Hosts without one
(iOS/iPadOS, Android below API 24) return
false. Defaults totrue.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetCursor(
) → Future< void> -
Clear any cursor this backend has applied, returning to the default. Used
on web (where the cursor is a CSS property we own) when a cursor session
ends, so nothing lingers; a no-op on native hosts (the OS manages it).
override
-
setCursor(
String key) → Future< void> -
Make the cursor registered under
keythe active OS cursor.override -
setPointerHidden(
) → Future< void> -
Hide/show the system pointer, used by NativeMouseCursorOverlay so the
painted cursor replaces it instead of doubling it. Implemented on Android
(a null
PointerIcon); a no-op elsewhere (web/desktop hide via Flutter's ownSystemMouseCursors.none). Defaults to a no-op.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
registerWith(
Registrar registrar) → void