TaxRateCreateOptions.fromJson constructor

TaxRateCreateOptions.fromJson(
  1. Object? json
)

Implementation

factory TaxRateCreateOptions.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return TaxRateCreateOptions(
    active: map['active'] == null ? null : (map['active'] as bool),
    country: map['country'] == null ? null : (map['country'] as String),
    description:
        map['description'] == null ? null : (map['description'] as String),
    displayName: (map['display_name'] as String),
    expand: map['expand'] == null
        ? null
        : (map['expand'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    inclusive: (map['inclusive'] as bool),
    jurisdiction:
        map['jurisdiction'] == null ? null : (map['jurisdiction'] as String),
    metadata: map['metadata'] == null
        ? null
        : (map['metadata'] as Map).cast<String, Object?>().map((
              key,
              value,
            ) =>
                MapEntry(
                  key,
                  (value as String),
                )),
    percentage: (map['percentage'] as num).toDouble(),
    state: map['state'] == null ? null : (map['state'] as String),
    taxType: map['tax_type'] == null
        ? null
        : TaxProductResourceLineItemTaxBreakdownTaxRateDetailsTaxType
            .fromJson(map['tax_type']),
  );
}