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

A plugin for playing single short audio asset file on Android and iOS

example/lib/main.dart

import 'package:beep_player/beep_player.dart';
import 'package:flutter/material.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(
    home: HomePage(),
  ));
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  static const BeepFile _beepFile = BeepFile('assets/beep.wav');

  @override
  void initState() {
    super.initState();
    BeepPlayer.load(_beepFile);
  }

  @override
  void dispose() {
    BeepPlayer.unload(_beepFile);
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: _onPressed,
          child: const Text('Beep'),
        ),
      ),
    );
  }

  void _onPressed() {
    BeepPlayer.play(_beepFile);
  }
}
6
likes
160
points
112
downloads

Publisher

unverified uploader

Weekly Downloads

A plugin for playing single short audio asset file on Android and iOS

Repository
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on beep_player