Skip to content
pubscout

headset_connection_event

4.1.0, released 9 months ago by themobilecoder.com

Flutter plugin to detect headset plug/unplug and Bluetooth connection events.

WASM-ready
$ flutter pub add headset_connection_event
Source repository

What it does

Provides APIs to get the current headset state and listen for changes when a headset is plugged or unplugged. Supports both physical and Bluetooth headsets on Android and iOS.

AI-written summary of version 4.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to react to headset plug/unplug events in your app
  • You need to know whether a Bluetooth headset is connected

Skip it when

  • You only need basic audio playback without headset awareness
  • You prefer a stream‑based API instead of callbacks

Strengths

  • Supports physical and Bluetooth headsets on both platforms
  • Simple callback‑based API
  • Null‑safe implementation

Weaknesses

  • Requires manual AndroidManifest changes and permission handling
  • No stream or reactive API

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
0

Update compileSdkVersion to 33, add a receiver and exported activity in AndroidManifest, request BLUETOOTH_CONNECT permission (e.g., via permission_handler).

import 'package:headset_connection_event/headset_event.dart';

HeadsetEvent headsetPlugin = HeadsetEvent();
HeadsetState headsetEvent;

headsetPlugin.getCurrentState.then((_val){
  setState(() => headsetEvent = _val);
});

headsetPlugin.setListener((_val){
  setState(() => headsetEvent = _val);
});

Alternatives

Packages that do the same job and could replace headset_connection_event.