getByScope method

List<Shortcut> getByScope(
  1. ShortcutScope scope
)

Implementation

List<Shortcut> getByScope(ShortcutScope scope) {
  final list = c.native_shortcut_manager_get_by_scope(scope.raw);
  final items = <Shortcut>[];
  for (var i = 0; i < list.count; i++) {
    items.add(Shortcut.fromHandle(list.shortcuts[i]));
  }
  final listPointer = pkg_ffi.calloc<c.native_shortcut_list_t>();
  listPointer.ref = list;
  // The handles now belong to `items`; free just the array.
  c.native_shortcut_list_release(listPointer);
  pkg_ffi.calloc.free(listPointer);
  return items;
}