bluetoothConnectionStateFromString function
将原生字符串转换为 BluetoothConnectionState。
参数:
value:原生连接状态名称,默认可传null;无法识别时返回 BluetoothConnectionState.unknown。
Implementation
BluetoothConnectionState bluetoothConnectionStateFromString(String? value) {
return BluetoothConnectionState.values.firstWhere(
(state) => state.name == value,
orElse: () => BluetoothConnectionState.unknown,
);
}