registerCursor method
Note
The documentation from engine/shell/platform/cursor_handler.cc
.
// This method allows creating a custom cursor with rawBGRA buffer, returns a string to identify the cursor.
static constexpr char kCreateCustomCursorMethod[] = "createCustomCursor/windows";
// A string, the custom cursor's name.
static constexpr char kCustomCursorNameKey[] = "name";
// A list of bytes, the custom cursor's rawBGRA buffer.
static constexpr char kCustomCursorBufferKey[] = "buffer";
// A double, the x coordinate of the custom cursor's hotspot, starting from left.
static constexpr char kCustomCursorHotXKey[] = "hotX";
// A double, the y coordinate of the custom cursor's hotspot, starting from top.
static constexpr char kCustomCursorHotYKey[] = "hotY";
// An int value for the width of the custom cursor.
static constexpr char kCustomCursorWidthKey[] = "width";
// An int value for the height of the custom cursor.
static constexpr char kCustomCursorHeightKey[] = "height";
// This method allows setting a custom cursor with a unique int64_t key of the custom cursor.
static constexpr char kSetCustomCursorMethod[] = "setCustomCursor/windows";
This method allows deleting a custom cursor with a string key.
static constexpr char kDeleteCustomCursorMethod[] = "deleteCustomCursor/windows";
Implementation
Future<String> registerCursor(CursorData data) async {
final cursorName = await _getMethodChannel()
.invokeMethod<String>(_getMethod(createCursorKey), data.toJson());
assert(cursorName == data.name);
return cursorName!;
}