copyWith method

  1. @override
Printer copyWith({
  1. String? deviceId,
  2. String? address,
  3. String? name,
  4. ConnectionType? connectionType,
  5. bool? isConnected,
  6. String? vendorId,
  7. String? productId,
  8. String? deviceUri,
  9. String? queueName,
  10. List<String>? services,
  11. Map<String, Uint8List>? serviceData,
  12. List<ManufacturerData>? manufacturerDataList,
})
override

Create a copy with updated fields

Advertisement data (services, serviceData, manufacturerDataList) is carried over unless explicitly overridden, so connection-state updates do not discard what the scan reported.

deviceId is accepted so this is a valid override of BleDevice.copyWith; for a Printer it is the same as address.

Implementation

@override
Printer copyWith({
  String? deviceId,
  String? address,
  String? name,
  ConnectionType? connectionType,
  bool? isConnected,
  String? vendorId,
  String? productId,
  String? deviceUri,
  String? queueName,
  List<String>? services,
  Map<String, Uint8List>? serviceData,
  List<ManufacturerData>? manufacturerDataList,
}) => Printer(
  address: address ?? deviceId ?? this.address,
  name: name ?? this.name,
  connectionType: connectionType ?? this.connectionType,
  isConnected: isConnected ?? this.isConnected,
  vendorId: vendorId ?? this.vendorId,
  productId: productId ?? this.productId,
  deviceUri: deviceUri ?? this.deviceUri,
  queueName: queueName ?? this.queueName,
  services: services ?? this.services,
  serviceData: serviceData ?? this.serviceData,
  manufacturerDataList: manufacturerDataList ?? this.manufacturerDataList,
);