Skip to content

Flutter library to capture connect and disconnect events from headets

License

Notifications You must be signed in to change notification settings

seal7766/headset_connection_event

 
 

Repository files navigation

Headset Connection Event Flutter Plugin

A Flutter plugin to get a headset event.

This is a clone of headset_event, but with fix on swift errors and bluetooth connection events for Android and iOS

Migrated to AndroidX

Current Status

Platform Physical Headset Bluetooth
iOS
Android

Usage

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

Example

    // Import package
    import 'package:headset_connection_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 library to capture connect and disconnect events from headets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 36.3%
  • Dart 27.2%
  • Swift 18.1%
  • Ruby 13.6%
  • Objective-C 4.8%