ShippingRateUpdateOptions.fromJson constructor

ShippingRateUpdateOptions.fromJson(
  1. Object? json
)

Implementation

factory ShippingRateUpdateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ShippingRateUpdateOptions(
    active: map['active'] == null ? null : (map['active'] as bool),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    fixedAmount: map['fixed_amount'] == null
        ? null
        : ShippingRateFixedAmount.fromJson(map['fixed_amount']),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    taxBehavior: map['tax_behavior'] == null
        ? null
        : ShippingRateCurrencyOptionTaxBehavior.fromJson(map['tax_behavior']),
  );
}