WindowsNotificationAudio.asset constructor

WindowsNotificationAudio.asset(
  1. String assetName, {
  2. bool shouldLoop = false,
  3. WindowsNotificationSound fallback = WindowsNotificationSound.defaultSound,
})

Uses an audio file from a Flutter asset.

Note that this will only work in release builds that have been packaged as an MSIX installer. If you pass a WindowsNotificationSound for fallback it will be used in debug and releases without MSIX.

Windows supports the following formats: .aac, .flac, .m4a, .mp3, .wav, and .wma.

Implementation

WindowsNotificationAudio.asset(
  String assetName, {
  this.shouldLoop = false,
  WindowsNotificationSound fallback = WindowsNotificationSound.defaultSound,
})  : isSilent = false,
      source = MsixUtils.hasPackageIdentity()
          ? MsixUtils.getAssetUri(assetName).toString()
          : fallback.name;