startAdvertising method

  1. @override
Future<void> startAdvertising({
  1. BluetoothAdvertisementData advertisementData = const BluetoothAdvertisementData(),
  2. BluetoothAdvertisementData? scanResponse,
  3. BluetoothAdvertisingSettings settings = const BluetoothAdvertisingSettings(),
})
override

实现 FlutterBluetoothPluginPlatform.startAdvertising

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

Implementation

@override
Future<void> startAdvertising({
  BluetoothAdvertisementData advertisementData =
      const BluetoothAdvertisementData(),
  BluetoothAdvertisementData? scanResponse,
  BluetoothAdvertisingSettings settings =
      const BluetoothAdvertisingSettings(),
}) async {
  await methodChannel
      .invokeMethod<void>('startAdvertising', <String, dynamic>{
    'advertisementData': advertisementData.toMap(),
    'scanResponse': scanResponse?.toMap(),
    'settings': settings.toMap(),
  });
}