BluetoothAdvertisementData constructor
const
BluetoothAdvertisementData({})
创建广播数据。
参数:
localName:广播本地名称,默认null。iOS/macOS 当前只使用该字段和serviceUuids。includeDeviceName:是否包含适配器设备名,默认false;Android 支持,iOS/macOS 忽略。includeTxPowerLevel:是否包含发射功率,默认false;Android 支持,iOS/macOS 忽略。serviceUuids:广播服务 UUID,默认const <String>[]。跨平台推荐只放必要服务。manufacturerData:厂商数据,默认const <int, List<int>>{};Android 支持,iOS/macOS 当前忽略。serviceData:服务数据,默认const <String, List<int>>{};Android 支持,iOS/macOS 当前忽略。
推荐:传统广播数据空间有限,优先保留 localName 和关键 serviceUuids,避免同时开启
includeDeviceName 和大量厂商数据导致 Android 广播启动失败。
Implementation
const BluetoothAdvertisementData({
this.localName,
this.includeDeviceName = false,
this.includeTxPowerLevel = false,
this.serviceUuids = const <String>[],
this.manufacturerData = const <int, List<int>>{},
this.serviceData = const <String, List<int>>{},
});