PriceUpdateOptions.fromJson constructor

PriceUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory PriceUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return PriceUpdateOptions(
    active: map['active'] == null ? null : (map['active'] as bool),
    currencyOptions: map['currency_options'] == null
        ? null
        : (map['currency_options'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  PriceCurrencyOptionsValue.fromJson(value),
                )),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    lookupKey:
        map['lookup_key'] == null ? null : (map['lookup_key'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    nickname: map['nickname'] == null ? null : (map['nickname'] as String),
    taxBehavior: map['tax_behavior'] == null
        ? null
        : ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
    transferLookupKey: map['transfer_lookup_key'] == null
        ? null
        : (map['transfer_lookup_key'] as bool),
  );
}