better_sound_effect 0.0.1 copy "better_sound_effect: ^0.0.1" to clipboard
better_sound_effect: ^0.0.1 copied to clipboard

outdated

A Sound Effect Player for Flutter.

better_sound_effect #

A Sound Effect Player for Flutter.

Install Started #

  1. Add this to your pubspec.yaml file:
dependencies:
  better_sound_effect: ^0.0.1
  1. Install it
$ flutter packages get

Normal usage #


  int? soundId;

  @override
  void initState() {
    super.initState();

    Future.microtask(() async {
      soundId = await soundEffect.loadAssetAudioFile("assets/button.wav");
    });
  }

  @override
  void dispose() {
    if (soundId != null) {
      soundEffect.release(soundId!);
    }
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: CupertinoButton(
            child: Text("click"),
            onPressed: () {
              if (soundId != null) {
                soundEffect.play(soundId!);
              }
            },
          ),
        ),
      ),
    );
  }

Feature #

  • ✅ play asset sound effect
  • ✅ only support wav file
3
likes
0
pub points
59%
popularity

Publisher

unverified uploader

A Sound Effect Player for Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on better_sound_effect