Models (Flutter)¶
All data models use Freezed for immutable data classes with copyWith, == override, JSON serialization, and union types.
Source: pharmanet/lib/core/models/
Model Inventory¶
| Model | File | Freezed? | Key Purpose |
|---|---|---|---|
| User | api_models.dart |
No | Auth user (mobile, email, role) |
| Profile | profile_model.dart |
Yes | Full user profile with settings |
| Seller | profile_model.dart |
Yes | Pharmacy/seller profile |
| Product | product_model.dart |
Yes | Product with variants, pricing |
| Category | product_model.dart |
Yes | Product category |
| Brand | product_model.dart |
Yes | Manufacturer |
| Order | order_model.dart |
Yes | Order with items, payment |
| Payment | order_model.dart |
Yes | Chapa transaction record |
| Promotion | promotion_model.dart |
Yes | Campaign timeline |
| OfferProduct | promotion_model.dart |
Yes | Seller discount offer |
| AppNotification | notification_model.dart |
Yes | User notification |
| CartItem | cart_model.dart |
Yes | Cart entry |
| Address | address_model.dart |
Yes | User shipping address |
| ChatRoom | chat_model.dart |
Yes | Chat conversation |
| ChatMessage | chat_model.dart |
Yes | Chat message |
| Review | review_model.dart |
Yes | Product review |
| SecuritySettings | security_settings_model.dart |
Yes | Security preferences |
Code Generation¶
This generates:
- .freezed.dart — Freezed implementation
- .g.dart — JSON serialization
Related¶
- Architecture — App structure
- Providers — Riverpod state management
- Supabase Schema — Database tables