update method

Future<void> update(
  1. Object id,
  2. UpdateProperties updateProperties
)

Updates a previously created context menu item. id The ID of the item to update. updateProperties The properties to update. Accepts the same values as the contextMenus.create function. returns Called when the context menu has been updated.

Implementation

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