startScan method

  1. @override
Future<void> startScan({
  1. List<String> serviceUuids = const <String>[],
  2. Duration? timeout,
  3. bool allowDuplicates = false,
  4. BluetoothScanMode scanMode = BluetoothScanMode.ble,
})
override

实现 FlutterBluetoothPluginPlatform.startScan

参数、默认值、平台差异和推荐值见平台接口文档。

Implementation

@override
Future<void> startScan({
  List<String> serviceUuids = const <String>[],
  Duration? timeout,
  bool allowDuplicates = false,
  BluetoothScanMode scanMode = BluetoothScanMode.ble,
}) async {
  await methodChannel.invokeMethod<void>('startScan', <String, dynamic>{
    'serviceUuids': serviceUuids,
    'timeoutMs': timeout?.inMilliseconds,
    'allowDuplicates': allowDuplicates,
    'scanMode': scanMode.name,
  });
}