BluetoothAdapterInfo.fromMap constructor
从原生 Map 创建适配器信息。
参数:
map:原生适配器数据,无默认值;缺失布尔字段会按false处理。
Implementation
factory BluetoothAdapterInfo.fromMap(Map<String, dynamic> map) {
return BluetoothAdapterInfo(
isSupported: _asBool(map['isSupported']),
state: bluetoothAdapterStateFromString(map['state']?.toString()),
name: map['name']?.toString(),
address: map['address']?.toString(),
isBleSupported: _asBool(map['isBleSupported']),
isMultipleAdvertisementSupported:
_asBool(map['isMultipleAdvertisementSupported']),
isOffloadedFilteringSupported:
_asBool(map['isOffloadedFilteringSupported']),
isOffloadedScanBatchingSupported:
_asBool(map['isOffloadedScanBatchingSupported']),
isLe2MPhySupported: _asBool(map['isLe2MPhySupported']),
isLeCodedPhySupported: _asBool(map['isLeCodedPhySupported']),
isLeExtendedAdvertisingSupported:
_asBool(map['isLeExtendedAdvertisingSupported']),
isLePeriodicAdvertisingSupported:
_asBool(map['isLePeriodicAdvertisingSupported']),
isDiscovering: _asBool(map['isDiscovering']),
raw: map,
);
}