BluetoothGattCharacteristic constructor
BluetoothGattCharacteristic({})
创建 GATT 特征。
参数:
uuid:特征 UUID,无默认值。serviceUuid:所属服务 UUID,无默认值。properties:特征属性,默认const <String>[]。常用值:read、write、writeWithoutResponse、notify、indicate。iOS/macOS 额外支持notifyEncryptionRequired、indicateEncryptionRequired。permissions:本地 GATT Server 权限,默认const <String>[]。为空时 Android/iOS/macOS 都会按可读可写处理;加密权限存在平台差异,跨平台推荐使用read、write。value:初始值,默认空 Uint8List。descriptors:描述符列表,默认const <BluetoothGattDescriptor>[]。raw:原生完整字段,默认const <String, dynamic>{}。
Implementation
BluetoothGattCharacteristic({
required this.uuid,
required this.serviceUuid,
this.properties = const <String>[],
this.permissions = const <String>[],
Uint8List? value,
this.descriptors = const <BluetoothGattDescriptor>[],
this.raw = const <String, dynamic>{},
}) : value = value ?? Uint8List(0);