SetIconDetails constructor

SetIconDetails({
  1. required int tabId,
  2. Object? imageData,
  3. Object? path,
  4. int? iconIndex,
})

Implementation

SetIconDetails({
  /// The id of the tab for which you want to modify the page action.
  required int tabId,

  /// Either an ImageData object or a dictionary {size -> ImageData}
  /// representing icon to be set. If the icon is specified as a dictionary,
  /// the actual image to be used is chosen depending on screen's pixel
  /// density. If the number of image pixels that fit into one screen space
  /// unit equals `scale`, then image with size `scale` * n will be selected,
  /// where n is the size of the icon in the UI. At least one image must be
  /// specified. Note that 'details.imageData = foo' is equivalent to
  /// 'details.imageData = {'16': foo}'
  Object? imageData,

  /// Either a relative image path or a dictionary {size -> relative image
  /// path} pointing to icon to be set. If the icon is specified as a
  /// dictionary, the actual image to be used is chosen depending on screen's
  /// pixel density. If the number of image pixels that fit into one screen
  /// space unit equals `scale`, then image with size `scale` * n will be
  /// selected, where n is the size of the icon in the UI. At least one image
  /// must be specified. Note that 'details.path = foo' is equivalent to
  /// 'details.path = {'16': foo}'
  Object? path,

  /// **Deprecated.** This argument is ignored.
  int? iconIndex,
}) : _wrapped = $js.SetIconDetails(
        tabId: tabId,
        imageData: switch (imageData) {
          JSObject() => imageData,
          Map() => imageData.jsify()!,
          null => null,
          _ => throw UnsupportedError(
              'Received type: ${imageData.runtimeType}. Supported types are: JSObject, Map')
        },
        path: switch (path) {
          String() => path.jsify()!,
          Map() => path.jsify()!,
          null => null,
          _ => throw UnsupportedError(
              'Received type: ${path.runtimeType}. Supported types are: String, Map')
        },
        iconIndex: iconIndex,
      );