getState method
Returns the current BluetoothState reported by the native iOS plugin.
The native side only ever returns "on", "off" or "uknow" (values
such as resetting, unauthorized and unsupported are coalesced to
"uknow"). Any unexpected value is also mapped to
BluetoothState.uknow.
Implementation
Future<BluetoothState> getState() async {
try {
final result = await _channel.invokeMethod<String>('getBluetoothState');
return enumFromString(BluetoothState.values, result) ??
BluetoothState.uknow;
} catch (_) {
return BluetoothState.uknow;
}
}