Skip to content

flutter-moum/flutter_headset_event

Repository files navigation

Headset Event Flutter Plugin

A Flutter plugin to get a headset event.

Migrated to AndroidX

Usage

To use this plugin, add headset_event as a dependency in your pubspec.yaml file.

Example

    // Import package
    import 'package:headset_event/headset_event.dart';

    // Instantiate it
    HeadsetEvent headsetPlugin = new HeadsetEvent();
    HeadsetState headsetEvent;

    /// if headset is plugged
    headsetPlugin.getCurrentState.then((_val){
      setState(() {
        headsetEvent = _val;
      });
    });

    /// Detect the moment headset is plugged or unplugged
    headsetPlugin.setListener((_val) {
      setState(() {
        headsetEvent = _val;
      });
    });

About

Flutter plugin for detecting headset event

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •