BluetoothGattService constructor

const BluetoothGattService({
  1. required String uuid,
  2. bool isPrimary = true,
  3. List<BluetoothGattCharacteristic> characteristics = const <BluetoothGattCharacteristic>[],
  4. List<String> includedServices = const <String>[],
  5. Map<String, dynamic> raw = const <String, dynamic>{},
})

创建 GATT 服务。

参数:

  • uuid:服务 UUID,无默认值。
  • isPrimary:是否主服务,默认 true
  • characteristics:特征列表,默认 const <BluetoothGattCharacteristic>[]
  • includedServices:包含的服务 UUID,默认 const <String>[]。平台支持有限,通常可为空。
  • raw:原生完整字段,默认 const <String, dynamic>{}

Implementation

const BluetoothGattService({
  required this.uuid,
  this.isPrimary = true,
  this.characteristics = const <BluetoothGattCharacteristic>[],
  this.includedServices = const <String>[],
  this.raw = const <String, dynamic>{},
});