copyWith method

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

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.

Implementation

Printer copyWith({
  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 ?? 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,
);