TaxRate.fromJson constructor
TaxRate.fromJson(
- Object? json
Implementation
factory TaxRate.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return TaxRate(
active: (map['active'] as bool),
country: map['country'] == null ? null : (map['country'] as String),
created:
DateTime.fromMillisecondsSinceEpoch((map['created'] as int).toInt()),
description:
map['description'] == null ? null : (map['description'] as String),
displayName: (map['display_name'] as String),
effectivePercentage: map['effective_percentage'] == null
? null
: (map['effective_percentage'] as num).toDouble(),
id: (map['id'] as String),
inclusive: (map['inclusive'] as bool),
jurisdiction:
map['jurisdiction'] == null ? null : (map['jurisdiction'] as String),
jurisdictionLevel: map['jurisdiction_level'] == null
? null
: TaxRateJurisdictionLevel.fromJson(map['jurisdiction_level']),
livemode: (map['livemode'] as bool),
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
: TaxProductResourceTaxRateDetailsTaxType.fromJson(map['tax_type']),
);
}