Product Model
models/product.dart · Product + Variant + Option + Category
Overview
Mirrors Medusa's physical product shape: id, title, description, thumbnail, images, options (Color/Size/etc.), variants (with calculated_price), categories, tags, plus a client-only isFavorite flag for the heart toggle.
User Flow
- Product.fromJson parses the response from /store/physical-products.
- Variant.calculatedPrice carries the per-region price the UI displays.
- copyWith(isFavorite) is used by toggleFavorite without mutating the original.
Cases & Edge Cases
- isFavorite is local-only — it doesn't round-trip to the backend in this feature (wishlist persistence lives in another service).
- calculated_price requires the `fields=*variants.calculated_price` query param — without it, variants render at 0.
- options & variants are independent: options describe the schema (Color/Size), variants are the realized SKU combinations.
Code References
- lib/src/features/shared/marketplace/models/product.dart // Product, Variant, Option, Category
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
The same Product class is reused by the provision marketplace — booking services are modeled as 'products' with metadata.type='provision'.