WindowsImage class

An image in a Windows notification.

Windows supports a few different URI types, and supports them differently depending on if your app is packaged as an MSIX. Refer to the following:

URI Debug Release (EXE) Release (MSIX)
http(s)://
ms-appx://
file:/// 🟨
getAssetUri()

Each URI type has different uses:

  • For Flutter assets, use getAssetUri, which return the correct file URI for debug and release (exe) builds, and an ms-appx URI in MSIX builds.
  • For images from the web, use an https or http URI, but note that these only work in MSIX apps. If you need a network image without using MSIX, consider downloading it directly and using a file URI after. Also note that showing the notification will cause the image to be downloaded, which could cause a small delay. Try to use small images.
  • For images that come from the user's device, or have to be retrieved at runtime, use a file URI, but as always, be aware of how paths might change from your device to your users. Note that file URIs must be absolute paths, not relative, which can be complicated if referring to MSIX assets.
  • For images that are bundled with your app but not through Flutter, use an ms-appx URI.
Inheritance

Constructors

WindowsImage.new(Uri uri, {required String altText, bool addQueryParams = false, WindowsImagePlacement? placement, WindowsImageCrop? crop})
Creates a Windows notification image from an image URI.
const

Properties

addQueryParams bool
Whether Windows should add URL query parameters when fetching the image.
final
altText String
A description of the image to be used by assistive technology.
final
crop WindowsImageCrop?
How the image will be cropped. Null indicates uncropped.
final
hashCode int
The hash code for this object.
no setterinherited
placement WindowsImagePlacement?
Where this image will be placed. Null indicates below the notification.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uri Uri
The source of the image.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getAssetUri(String assetName) Uri
Returns a URI for a Flutter asset.