SessionProductData.fromJson constructor

SessionProductData.fromJson(
  1. Object? json
)

Implementation

factory SessionProductData.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return SessionProductData(
    description:
        map['description'] == null ? null : (map['description'] 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),
    taxCode: map['tax_code'] == null ? null : (map['tax_code'] as String),
  );
}