BluetoothGattCharacteristic.fromMap constructor
从原生 Map 创建 GATT 特征。
参数:
map:原生特征数据,无默认值。
Implementation
factory BluetoothGattCharacteristic.fromMap(Map<String, dynamic> map) {
final descriptors =
(map['descriptors'] as List<dynamic>? ?? const <dynamic>[])
.map((item) => BluetoothGattDescriptor.fromMap(_asStringMap(item)))
.toList(growable: false);
return BluetoothGattCharacteristic(
uuid: map['uuid']?.toString() ?? '',
serviceUuid: map['serviceUuid']?.toString() ?? '',
properties: _asStringList(map['properties']),
permissions: _asStringList(map['permissions']),
value: _asByteList(map['value']),
descriptors: descriptors,
raw: map,
);
}