copyWith method

ServiceSpec copyWith({
  1. Version? version,
  2. ServiceMetadata? metadata,
  3. Kind? kind,
  4. String? id,
  5. List<PortSpec>? ports,
  6. ContainerSpec? container,
  7. ExternalServiceSpec? external,
})

Implementation

ServiceSpec copyWith({
  Version? version,
  ServiceMetadata? metadata,
  Kind? kind,
  String? id,
  List<PortSpec>? ports,
  ContainerSpec? container,
  ExternalServiceSpec? external,
}) {
  return ServiceSpec(
    version: version ?? this.version,
    metadata: metadata ?? this.metadata,
    kind: kind ?? this.kind,
    id: id ?? this.id,
    ports: ports ?? List<PortSpec>.from(this.ports),
    container: external != null ? null : container ?? this.container,
    external: container != null ? null : external ?? this.external,
  );
}