Audio playback for Dart and Flutter across platforms. Native builds require Rust in addition to Dart or Flutter. Precompiled binaries are planned to remove that build requirement.
This is a melos monorepo:
| Package | What it is |
|---|---|
packages/sound_dart |
Pure Dart (no Flutter); works in CLI tools. Reaches native audio over dart:ffi, with a pluggable backend registry. |
packages/sound_flutter |
Flutter plugin. Builds the native library automatically (via cargokit) and re-exports the sound_dart API. |
packages/sound_flutter/rust |
The sound_cli Rust crate (the C ABI behind the FFI backend), kept inside sound_flutter so it ships with that package. Decodes WAV/MP3/OGG/FLAC and plays with no system deps - loads the OS audio library at runtime: libasound.so.2 on Linux, libaaudio.so on Android, AudioToolbox on macOS/iOS, winmm.dll on Windows. |
import 'package:sound_dart/sound_dart.dart';
final playback = await Sound.playFile('chime.wav', volume: 0.8);
await playback.onComplete;Build the native library first: cargo build --manifest-path packages/sound_flutter/rust/Cargo.toml.
| Host | Status |
|---|---|
| Android | Working |
| Android Emulator | Working |
| iOS | Working |
| iOS Simulator | Working |
| macOS | Working |
| Ubuntu 24.04 | Working |
| Web | Working |
| Windows 11 | Working |
Android Emulator tested on macOS, Ubuntu 24.04, and Windows 11. Web tested on macOS in Chrome and Safari, Ubuntu 24.04 in Chrome and Firefox, and Windows 11 in Chrome and Edge.
Driven by melos (config lives in the root
pubspec.yaml). After dart pub get (or flutter pub get):
dart run melos run native:build # build the Rust shared library
dart run melos run analyze # analyze sound_dart + sound_flutter
dart run melos run format # check Dart formatting (format:fix to apply)
dart run melos run test # Dart + Flutter tests
dart run melos run native:test # Rust crate teststool/native_payload.py --config tool/payload.json --mode candidate --output /tmp/sound-candidate
verifies actual pub-selected archives in a fresh Flutter consumer. See
tool/README.md for legacy hosted compatibility and platform gates.
The older tool/consumer_build.sh is only a Git-export comparison smoke, and
flutter test integration_test -d <device> (from
packages/sound_flutter/example) runs the on-device playback tests.
- Run the example and the integration tests on each platform's real hardware, Windows and Apple devices included.
- After private rehearsal, the owner may manually mirror the reviewed source
and dispatch
.github/workflows/precompile.ymlon GitHub. Tag pushes do not release anything. The guarded workflow validates signing-key identity before creating a release; maintenance never executes this public step. - Owner publication must release
sound_dart0.0.2 first, thensound_flutter, which requires itsSound.initializeAPI. Public publication is not performed by the private maintenance gates.