JsonHelper class

Helper class around product field conversion to/from JSON

Constructors

JsonHelper()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

allImagesFromJson(Map? json) → List<ProductImage>?
Returns ProductImages from a JSON map for "Images".
allImagesToJson(List<ProductImage>? images) → Map<String, dynamic>
attributeGroupsToJson(List<AttributeGroup>? list) → List<Map<String, dynamic>>?
Returns a JSON map from AttributeGroups
boolFromJSON(dynamic jsonValue) → bool?
Returns a bool from 0/1 conversion.
boolToJSON(dynamic value) → int?
Returns a bool to 0/1 conversion.
checkboxFromJSON(dynamic jsonValue) → bool?
Returns a bool from ''/'on' conversion.
checkboxToJSON(dynamic value) → String?
Returns a bool to ''/'on' conversion.
dateToTimestamp(DateTime? dateTime) → int?
Returns UTC seconds since epoch from a DateTime
ingredientsToJson(List<Ingredient>? ingredients) → List<Map<String, dynamic>>?
Returns a JSON map from Ingredients
nullableStringTimestampToDate(dynamic json) → DateTime?
Returns a DateTime from a JSON-encoded String (e.g. '2021-10-29T11:00:56.177379')
productPackagingsToJson(List<ProductPackaging>? packagings) → List<Map<String, dynamic>>?
Returns a JSON map from ProductPackagings
quantityFromJson(dynamic data) → double?
Returns a double from a JSON-encoded int or double
selectedImagesFromJson(Map? json) → List<ProductImage>?
Returns ProductImages from a product JSON map for "Selected images"
selectedImagesToJson(List<ProductImage>? images) → Map<String, dynamic>
Returns a JSON map from ProductImages for "Selected images"
stringFromJSON(dynamic jsonValue) → String?
Returns a String?, regardless of the input type.
stringTimestampToDate(dynamic json) → DateTime
Returns a DateTime from a JSON-encoded String (e.g. '2021-10-29T11:00:56.177379')
timestampToDate(dynamic json) → DateTime?
Returns a DateTime from a JSON-encoded int (UTC seconds since epoch)