BluetoothGattCharacteristic constructor
const
BluetoothGattCharacteristic({
- required String uuid,
- required String serviceUuid,
- List<
String> properties = const <String>[], - List<
String> permissions = const <String>[], - List<
int> value = const <int>[], - List<
BluetoothGattDescriptor> descriptors = const <BluetoothGattDescriptor>[], - Map<
String, dynamic> raw = const <String, dynamic>{},
创建 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:初始值,默认const <int>[]。descriptors:描述符列表,默认const <BluetoothGattDescriptor>[]。raw:原生完整字段,默认const <String, dynamic>{}。
Implementation
const BluetoothGattCharacteristic({
required this.uuid,
required this.serviceUuid,
this.properties = const <String>[],
this.permissions = const <String>[],
this.value = const <int>[],
this.descriptors = const <BluetoothGattDescriptor>[],
this.raw = const <String, dynamic>{},
});