getCurrentState property

Future<HeadsetState?> get getCurrentState

Reads asynchronously the current state of the headset with type HeadsetState

Implementation

Future<HeadsetState?> get getCurrentState async {
  final state = await _channel.invokeMethod<int?>('getCurrentState');
  switch (state) {
    case 0:
      return HeadsetState.DISCONNECT;
    case 1:
      return HeadsetState.CONNECT;
    default:
      return HeadsetState.DISCONNECT;
  }
}