remove method

Future<void> remove(
  1. Object menuItemId
)

Removes a context menu item. menuItemId The ID of the context menu item to remove. returns Called when the context menu has been removed.

Implementation

Future<void> remove(Object menuItemId) {
  var $completer = Completer<void>();
  $js.chrome.contextMenus.remove(
    switch (menuItemId) {
      int() => menuItemId.jsify()!,
      String() => menuItemId.jsify()!,
      _ => throw UnsupportedError(
          'Received type: ${menuItemId.runtimeType}. Supported types are: int, String')
    },
    () {
      if (checkRuntimeLastError($completer)) {
        $completer.complete(null);
      }
    }.toJS,
  );
  return $completer.future;
}