BackgroundTaskPrice.fromJson constructor
BackgroundTaskPrice.fromJson( - Map<String, dynamic> json
)
Implementation
BackgroundTaskPrice.fromJson(super.json)
: date = JsonHelper.stringTimestampToDate(json[_jsonTagDate] as String),
currency = Currency.fromName(json[_jsonTagCurrency] as String)!,
locationOSMId = json[_jsonTagOSMId] as int,
locationOSMType = LocationOSMType.fromOffTag(
json[_jsonTagOSMType] as String,
)!,
barcodes = json.containsKey(_jsonTagBarcode)
? <String>[json[_jsonTagBarcode] as String]
: _fromJsonListString(json[_jsonTagBarcodes])!,
categories = _fromJsonListString(json[_jsonTagCategories]) ?? <String>[],
origins =
_fromJsonListListString(json[_jsonTagOrigins]) ?? <List<String>>[],
labels =
_fromJsonListListString(json[_jsonTagLabels]) ?? <List<String>>[],
pricePers = _fromJsonListString(json[_jsonTagPricePers]) ?? <String>[],
pricesAreDiscounted = json.containsKey(_jsonTagIsDiscounted)
? <bool>[json[_jsonTagIsDiscounted] as bool]
: _fromJsonListBool(json[_jsonTagAreDiscounted])!,
prices = json.containsKey(_jsonTagPrice)
? <double>[json[_jsonTagPrice] as double]
: fromJsonListDouble(json[_jsonTagPrices])!,
pricesWithoutDiscount = json.containsKey(_jsonTagPriceWithoutDiscount)
? <double?>[json[_jsonTagPriceWithoutDiscount] as double?]
: _fromJsonListNullableDouble(json[_jsonTagPricesWithoutDiscount])!,
discountTypes = _normalizeDiscountTypes(
json[_jsonTagDiscountTypes],
json.containsKey(_jsonTagBarcode)
? 1
: (json[_jsonTagBarcodes] as List<dynamic>).length,
),
super.fromJson();