ProductCreateOptions.fromJson constructor
ProductCreateOptions.fromJson(
- Object? json
Implementation
factory ProductCreateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return ProductCreateOptions(
active: map['active'] == null ? null : (map['active'] as bool),
defaultPriceData: map['default_price_data'] == null
? null
: ProductDefaultPriceData.fromJson(map['default_price_data']),
description:
map['description'] == null ? null : (map['description'] as String),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
features: map['features'] == null
? null
: (map['features'] as List<Object?>)
.map((el) => ProductFeaturesItem.fromJson(el))
.toList(),
id: map['id'] == null ? null : (map['id'] as String),
images: map['images'] == null
? null
: (map['images'] as List<Object?>)
.map((el) => (el as String))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
name: (map['name'] as String),
packageDimensions: map['package_dimensions'] == null
? null
: PackageDimensions.fromJson(map['package_dimensions']),
shippable: map['shippable'] == null ? null : (map['shippable'] as bool),
statementDescriptor: map['statement_descriptor'] == null
? null
: (map['statement_descriptor'] as String),
taxCode: map['tax_code'] == null ? null : (map['tax_code'] as String),
type: map['type'] == null ? null : ProductType.fromJson(map['type']),
unitLabel:
map['unit_label'] == null ? null : (map['unit_label'] as String),
url: map['url'] == null ? null : (map['url'] as String),
);
}