assetAudioPath property
Path to audio asset to be used as the alarm ringtone. Accepted formats:
-
Project asset: Specifies an asset bundled with your Flutter project. Use this format for assets that are included in your project's
pubspec.yaml
file. Example:assets/audio.mp3
-
App Documents directory path: Specifies a path relative to your app's Documents directory. This is used for files stored in your app's local storage. Always use the relative path from the Documents directory, as the full path may change when the app updates.
For example, if your file is located at:
/var/mobile/Containers/Data/Application/<UUID>/Documents/custom_sounds/audio.mp3
You should only specify:custom_sounds/audio.mp3
This ensures the path remains valid even after app updates, as the UUID portion of the path may change.
Note: For Android, the READ_EXTERNAL_STORAGE permission is required in
your AndroidManifest.xml
to access files from local storage.
Implementation
final String assetAudioPath;