createWithIdAndOptions static method

Shortcut? createWithIdAndOptions(
  1. ShortcutId id,
  2. ShortcutOptions options
)

Creates a new Shortcut; returns null if the native side failed.

Implementation

static Shortcut? createWithIdAndOptions(
  ShortcutId id,
  ShortcutOptions options,
) {
  final optionsPointer = options.allocNative();
  final handle = c.native_shortcut_create_with_id_and_options(
    id,
    optionsPointer.ref,
  );
  ShortcutOptions.freeNative(optionsPointer);
  if (handle == 0) return null;
  return Shortcut.fromHandle(handle);
}