flutter_shared_model 1.3.1 copy "flutter_shared_model: ^1.3.1" to clipboard
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, Gender
  • AuditAction, StoragePathType, BadgeClass
  • Currency, BulkAction, OrderPrefix
  • Unit, City, Country, OrderType
  • BannerActionType, BannerPosition
  • NotificationTemplateType, NotificationPriority
  • CampaignType, BusinessType, KitchenType
  • SupportCategory, 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:

  1. Update the TypeScript shared model first
  2. Update this Flutter package to match
  3. Ensure enum values use camelCase consistently
  4. Update helper functions as needed

Contributing #

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Ensure all enums match the TypeScript version
  5. Add tests if applicable
  6. Submit a pull request

License #

MIT License - see LICENSE file for details.

0
likes
135
points
42
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Shared data models, interfaces, and enums for Insach food delivery platform (Flutter/Dart version)

Homepage

License

MIT (license)

Dependencies

flutter, json_annotation

More

Packages that depend on flutter_shared_model