copyWith method

Printer copyWith({
  1. String? address,
  2. String? name,
  3. ConnectionType? connectionType,
  4. bool? isConnected,
  5. String? vendorId,
  6. String? productId,
  7. List<String>? services,
  8. Map<String, Uint8List>? serviceData,
  9. 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,
  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,
      services: services ?? this.services,
      serviceData: serviceData ?? this.serviceData,
      manufacturerDataList: manufacturerDataList ?? this.manufacturerDataList,
    );