flutter_shared_model 1.3.1
flutter_shared_model: ^1.3.1 copied to clipboard
Shared data models, interfaces, and enums for Insach food delivery platform (Flutter/Dart version)
Flutter Shared Model Package #
A Flutter/Dart package containing shared data models, interfaces, enums, and types for the Insach food delivery platform.
Features #
- Synchronized Enums: All enums are synchronized with the TypeScript shared model package
- Consistent Naming: Uses camelCase enum values to match the shared model
- Type Safety: Strong typing with Dart enums and classes
- Helper Functions: Utility functions for enum parsing and conversion
- Constants: Database collection names and other constants
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_shared_model:
git:
url: https://github.com/insach67/flutter-shared-model.git
Usage #
Import the package #
import 'package:flutter_shared_model/flutter_shared_model.dart';
Using Enums #
// Order status
OrderStatus status = OrderStatus.pending;
print(status.value); // 'pending'
print(status.displayName); // 'Pending'
// Cuisine type
CuisineType cuisine = CuisineType.northIndian;
print(cuisine.value); // 'northIndian'
print(cuisine.displayName); // 'North Indian'
// Parse from string
OrderStatus parsedStatus = EnumHelper.parseOrderStatus('confirmed');
Using Constants #
// Database collections
String usersCollection = Collections.users; // 'users'
String ordersCollection = Collections.orders; // 'orders'
Using Helper Functions #
// Parse enums from strings
RoleType role = EnumHelper.parseRoleType('kitchenOwner');
PaymentMethod method = EnumHelper.parsePaymentMethod('upi');
CuisineType cuisine = EnumHelper.parseCuisineType('north_indian');
Available Enums #
Core Enums #
RoleType- User roles (admin, kitchenOwner, etc.)PaymentMethod- Payment methods (card, upi, cash, etc.)PaymentStatus- Payment statuses (pending, paid, failed, etc.)OrderStatus- Order statuses (pending, confirmed, delivered, etc.)DeliveryStatus- Delivery statuses (pending, assigned, delivered, etc.)CuisineType- Cuisine types (northIndian, southIndian, etc.)SpiceLevel- Spice levels (mild, medium, hot, extraHot)DishCategory- Dish categories (appetizer, mainCourse, etc.)AllergenType- Allergen types (nuts, dairy, eggs, etc.)DietaryType- Dietary types (vegetarian, vegan, jain, etc.)
Document Enums #
DocumentType- Document types (fssai, gst, pan, etc.)DocumentStatus- Document statuses (pending, approved, rejected, etc.)VerificationStatus- Verification statuses (pending, verified, rejected, etc.)
Additional Enums #
VehicleType,FuelType,GenderAuditAction,StoragePathType,BadgeClassCurrency,BulkAction,OrderPrefixUnit,City,Country,OrderTypeBannerActionType,BannerPositionNotificationTemplateType,NotificationPriorityCampaignType,BusinessType,KitchenTypeSupportCategory,SupportPriority,TaxType- And many more...
Synchronization #
This package is synchronized with the TypeScript shared model package (insach-shared-model). When updating enums or adding new ones:
- Update the TypeScript shared model first
- Update this Flutter package to match
- Ensure enum values use camelCase consistently
- Update helper functions as needed
Contributing #
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure all enums match the TypeScript version
- Add tests if applicable
- Submit a pull request
License #
MIT License - see LICENSE file for details.