encode<V> static method
Implementation
static V encode<V>(
ProductUpdateOptions instance,
Encoder<V> encoder,
) {
final container = encoder.container<String>();
if (instance.active != null) {
container.encodeBool(
'active',
instance.active!,
);
}
if (instance.defaultPrice != null) {
container.encodeString(
'default_price',
instance.defaultPrice!,
);
}
if (instance.description != null) {
container.encodeString(
'description',
instance.description!,
);
}
if (instance.expand != null) {
container.encodeList(
'expand',
(container) =>
instance.expand!.forEach((el) => container.encodeString(el)),
);
}
if (instance.features != null) {
container.encodeList(
'features',
(container) =>
instance.features!.forEach((el) => ProductFeaturesItem.encode(
el,
container.nestedSingleValueContainer().encoder,
)),
);
}
if (instance.images != null) {
container.encodeList(
'images',
(container) =>
instance.images!.forEach((el) => container.encodeString(el)),
);
}
if (instance.metadata != null) {
container.encodeMap(
'metadata',
(container) => instance.metadata!.forEach((
key,
value,
) =>
container.encodeString(
key,
value,
)),
);
}
if (instance.name != null) {
container.encodeString(
'name',
instance.name!,
);
}
if (instance.packageDimensions != null) {
PackageDimensions.encode(
instance.packageDimensions!,
container.nestedSingleValueContainer('package_dimensions').encoder,
);
}
if (instance.shippable != null) {
container.encodeBool(
'shippable',
instance.shippable!,
);
}
if (instance.statementDescriptor != null) {
container.encodeString(
'statement_descriptor',
instance.statementDescriptor!,
);
}
if (instance.taxCode != null) {
container.encodeString(
'tax_code',
instance.taxCode!,
);
}
if (instance.unitLabel != null) {
container.encodeString(
'unit_label',
instance.unitLabel!,
);
}
if (instance.url != null) {
container.encodeString(
'url',
instance.url!,
);
}
return container.value;
}