getAdapterInfo method

  1. @override
Future<BluetoothAdapterInfo> getAdapterInfo()
override

实现 FlutterBluetoothPluginPlatform.getAdapterInfo

Web 不公开适配器名称、地址或 Android 专属硬件能力。

Implementation

@override
Future<BluetoothAdapterInfo> getAdapterInfo() async {
  final supported = _isWebBluetoothSupported;
  final state = await getAdapterState();
  return BluetoothAdapterInfo(
    isSupported: supported,
    state: state,
    isBleSupported: supported,
    isDiscovering: _isSelectingDevice,
    raw: <String, dynamic>{
      'platform': 'web',
      'secureContext': web.window.isSecureContext,
      'hasWebBluetooth': _bluetooth != null,
    },
  );
}