getAssetUri static method
Returns a URI for a Flutter asset.
- In debug mode, resolves to a file URI to the asset itself
- In non-MSIX release builds, resolves to a file URI to the bundled asset
- In MSIX releases, resolves to an
ms-appx
URI fromMsix.getAssetUri
.
Implementation
static Uri getAssetUri(String assetName) {
if (kDebugMode) {
return Uri.file(File(assetName).absolute.path, windows: true);
} else if (MsixUtils.hasPackageIdentity()) {
return MsixUtils.getAssetUri(assetName);
} else {
return Uri.file(
File('data/flutter_assets/$assetName').absolute.path,
windows: true,
);
}
}