patchWithSurcharge method

Surcharge patchWithSurcharge([
  1. SurchargePatch? patchInput
])

Implementation

Surcharge patchWithSurcharge([SurchargePatch? patchInput]) {
  final _patcher = patchInput ?? SurchargePatch();
  final _patchMap = _patcher.patchMap;
  return Surcharge(
    createdAt: _patchMap.containsKey(Surcharge$.createdAt)
        ? ((_patchMap[Surcharge$.createdAt] is Function)
                  ? _patchMap[Surcharge$.createdAt](this.createdAt)
                  : (_patchMap[Surcharge$.createdAt] is Patch)
                  ? _patchMap[Surcharge$.createdAt].applyTo(this.createdAt)
                  : _patchMap[Surcharge$.createdAt])
              as DateTime
        : this.createdAt,
    description: _patchMap.containsKey(Surcharge$.description)
        ? ((_patchMap[Surcharge$.description] is Function)
                  ? _patchMap[Surcharge$.description](this.description)
                  : (_patchMap[Surcharge$.description] is Patch)
                  ? _patchMap[Surcharge$.description].applyTo(
                      this.description,
                    )
                  : _patchMap[Surcharge$.description])
              as String
        : this.description,
    id: _patchMap.containsKey(Surcharge$.id)
        ? ((_patchMap[Surcharge$.id] is Function)
                  ? _patchMap[Surcharge$.id](this.id)
                  : (_patchMap[Surcharge$.id] is Patch)
                  ? _patchMap[Surcharge$.id].applyTo(this.id)
                  : _patchMap[Surcharge$.id])
              as String
        : this.id,
    price: _patchMap.containsKey(Surcharge$.price)
        ? ((_patchMap[Surcharge$.price] is Function)
                  ? _patchMap[Surcharge$.price](this.price)
                  : (_patchMap[Surcharge$.price] is Patch)
                  ? _patchMap[Surcharge$.price].applyTo(this.price)
                  : _patchMap[Surcharge$.price])
              as double
        : this.price,
    priceWithTax: _patchMap.containsKey(Surcharge$.priceWithTax)
        ? ((_patchMap[Surcharge$.priceWithTax] is Function)
                  ? _patchMap[Surcharge$.priceWithTax](this.priceWithTax)
                  : (_patchMap[Surcharge$.priceWithTax] is Patch)
                  ? _patchMap[Surcharge$.priceWithTax].applyTo(
                      this.priceWithTax,
                    )
                  : _patchMap[Surcharge$.priceWithTax])
              as double
        : this.priceWithTax,
    sku: _patchMap.containsKey(Surcharge$.sku)
        ? ((_patchMap[Surcharge$.sku] is Function)
                  ? _patchMap[Surcharge$.sku](this.sku)
                  : (_patchMap[Surcharge$.sku] is Patch)
                  ? _patchMap[Surcharge$.sku].applyTo(this.sku)
                  : _patchMap[Surcharge$.sku])
              as String?
        : this.sku,
    taxLines: _patchMap.containsKey(Surcharge$.taxLines)
        ? ((_patchMap[Surcharge$.taxLines] is Function)
                  ? _patchMap[Surcharge$.taxLines](this.taxLines)
                  : (_patchMap[Surcharge$.taxLines] is Patch)
                  ? _patchMap[Surcharge$.taxLines].applyTo(this.taxLines)
                  : _patchMap[Surcharge$.taxLines])
              as List<TaxLine>
        : this.taxLines,
    taxRate: _patchMap.containsKey(Surcharge$.taxRate)
        ? ((_patchMap[Surcharge$.taxRate] is Function)
                  ? _patchMap[Surcharge$.taxRate](this.taxRate)
                  : (_patchMap[Surcharge$.taxRate] is Patch)
                  ? _patchMap[Surcharge$.taxRate].applyTo(this.taxRate)
                  : _patchMap[Surcharge$.taxRate])
              as double
        : this.taxRate,
    updatedAt: _patchMap.containsKey(Surcharge$.updatedAt)
        ? ((_patchMap[Surcharge$.updatedAt] is Function)
                  ? _patchMap[Surcharge$.updatedAt](this.updatedAt)
                  : (_patchMap[Surcharge$.updatedAt] is Patch)
                  ? _patchMap[Surcharge$.updatedAt].applyTo(this.updatedAt)
                  : _patchMap[Surcharge$.updatedAt])
              as DateTime
        : this.updatedAt,
  );
}