Address
models/address.dart
Overview
Mirrors Medusa's shipping/billing address shape: first_name, last_name, address_1/2, city, postal_code, province, country_code, phone and a metadata bag.
User Flow
- Address.fromJson maps the snake-case Medusa payload into camelCase fields.
- toJson re-emits snake-case for updateCart's shipping_address body.
- Empty-string defaults for missing required fields ensure fromJson never throws on partial backend responses.
Cases & Edge Cases
- metadata is opaque — used by the backend to flag 'address pre-filled from profile' vs 'manually entered', not by the client.
- countryCode optional, but Medusa shipping options key off it — missing it usually returns an empty shipping_options list.
Code References
- lib/src/features/shared/checkout/models/address.dart:1 // Address
- lib/src/features/shared/checkout/models/address.dart:30 // Address.fromJson
- lib/src/features/shared/checkout/models/address.dart:47 // toJson
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Used by both Cart.shippingAddress / billingAddress and the address picker widget in CheckoutScreen.