Easy and free 🆓 UI sounds library 🎶 for your general purposes 🎧 🔊
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies:
...
sound_library: ^1.0.0Add this import line
import 'package:sound_library/sound_library.dart'; Live example: Sounds Library
| Name | Description |
|---|---|
| Click | General button click |
| Action | General action sound (Usually no user interaction) |
| Open | Open drawer, open menu, open popup, etc. |
| Deleted | Delete item, delete file, etc. |
| Welcome | Welcome sound |
| Success | Indicates success or completed action |
| Drag | Drag and drop sound |
| Intro | Intro sound |
| Add to cart | Add to cart sound |
| Close (Wood hit) | High pitched sound of two wood blocks |
| Order Complete | Order completed sound |
| Cashing machine | Cashing machine sound |
SoundPlayer.play(Sounds.click, volume: 0.5, position: Duration(milliseconds: 500); SoundPlayer.play(Sounds.click); SoundPlayer.playFromUrl(path); SoundPlayer.playFromDeviceFilePath(file); SoundPlayer.playFromAssetPath(asset); SoundPlayer.playFromBytes(bytes); bool enabled = SoundPlayer.isAudioEnabled;This will also load the state from the device storage onto the isAudioEnabled property
bool enabled = await SoundPlayer.checkLocalStorageEnabled();This will also save the state to the device storage
SoundPlayer.setAudioEnabled(true/false);This package assumes corresponding permissions depending on platform. Also, take a look at the example project for more information.
