SetIcon constructor

SetIcon({
  1. required SetIconInstanceType instanceType,
  2. Object? imageData,
})

Implementation

SetIcon({
  required SetIconInstanceType instanceType,

  /// Either an `ImageData` object or a dictionary {size -> ImageData}
  /// representing an icon to be set. If the icon is specified as a
  /// dictionary, the image used is chosen depending on the screen's pixel
  /// density. If the number of image pixels that fit into one screen space
  /// unit equals `scale`, then an image with size `scale * n` is selected,
  /// where <i>n</i> 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,
}) : _wrapped = $js.SetIcon(
        instanceType: instanceType.toJS,
        imageData: switch (imageData) {
          JSObject() => imageData,
          Map() => imageData.jsify()!,
          null => null,
          _ => throw UnsupportedError(
              'Received type: ${imageData.runtimeType}. Supported types are: JSObject, Map')
        },
      );