moose_core library

moose_core — Core architecture for modular Flutter e-commerce applications.

This library provides a complete plugin-based architecture for building scalable, backend-agnostic Flutter e-commerce apps.

Import options

Import this file to access the full API:

import 'package:moose_core/moose_core.dart';

Or import specific modules for smaller build sizes:

import 'package:moose_core/entities.dart';
import 'package:moose_core/repositories.dart';
import 'package:moose_core/plugin.dart';
import 'package:moose_core/widgets.dart';
import 'package:moose_core/adapters.dart';
import 'package:moose_core/cache.dart';
import 'package:moose_core/services.dart';

Classes

ActionRegistry
AdapterRegistry
Instance-based registry for managing backend adapters and repository implementations.
Address
Represents a physical address.
AnonymousCredentials
Credentials for anonymous authentication.
ApiClient
Advanced API client with comprehensive features
AppliedCoupon
AppLogger
Simple logger utility for the application
AppNavigator
Centralized navigation service that uses EventBus for decoupled navigation.
AuthCredentials
Base class for authentication credentials.
AuthRepository
Abstract repository for authentication operations
AuthResult
Result of an authentication operation.
BackendAdapter
BackendAdapter - Abstract base class for backend implementations
BannerRepository
Repository responsible for retrieving promotional banners and reporting engagement metrics (views/clicks) back to the backend.
BootstrapReport
Structured result returned by MooseBootstrapper.run.
BottomTab
Configuration for a bottom navigation tab
CacheManager
Scoped cache manager that owns independent MemoryCache and PersistentCache instances for a single MooseAppContext.
CacheStats
Cache statistics for monitoring
Cart
Represents a shopping cart.
CartAmount
Represents an amount line item in the cart (shipping, tax, discount, etc.)
CartItem
Represents a single item in a shopping cart.
CartRepository
CartValidationResult
Category
Represents a product category.
CheckoutRequest
CheckoutResult
Collection
Represents a collection of products grouped together.
CollectionFilters
Filters for querying collections with pagination and search.
ColorHelper
Helper class for color operations and conversions
ConfigManager
CoreRepository
Base class for all repository implementations
Country
Represents a country with its code and name.
CountryState
Represents a state, province, or region within a country.
CurrencyFormatter
Helper class for formatting monetary values consistently across the app.
CustomTokenCredentials
Credentials for custom token authentication.
DeliveryMethod
DeliveryMethod represents a method of delivering products to the customer. This can be traditional shipping (FedEx, UPS, USPS), local delivery, pickup, digital delivery, or any custom delivery method.
EmailPasswordCredentials
Credentials for email/password authentication.
EmailVerificationResult
Event
Event - Represents an event in the system
EventBus
EventBus - A publish-subscribe messaging system for decoupled communication
EventSubscription
Subscription handle that allows unsubscribing from events
FeaturePlugin
Base class for all feature plugins in the application.
FeatureSection
Abstract base class for all feature sections in the application.
FilterPreset
Represents a saved filter preset for quick product filtering.
Hook
HookRegistry
LocationRepository
Repository for location-based operations.
MediaItem
MediaItem - Represents a media asset (image, video, etc.)
MemoryCache
In-memory cache with memory management and leak prevention.
MooseApp
A self-contained root widget that bootstraps a moose_core application.
MooseAppContext
The dependency-injection container for a running moose_core application.
MooseBootstrapper
Orchestrates the moose_core startup sequence against a MooseAppContext.
MooseLifecycleObserver
Bridges Flutter's AppLifecycleState changes to all registered plugins in a MooseAppContext.
MooseScope
Provides a MooseAppContext to the widget tree and manages plugin lifecycle observer wiring for that context.
NotificationSettings
Represents notification settings and preferences for the user.
OAuthCredentials
Credentials for OAuth providers (Google, Facebook, Apple, etc.).
Order
Represents a customer order.
OrderLineItem
PaginatedResult<T>
Wrapper for paginated data with metadata about pages and items.
PasswordResetResult
PaymentMethod
PaymentResult
PersistentCache
Persistent cache using SharedPreferences for data that survives app restarts.
PhoneCredentials
Credentials for phone number authentication.
PluginConfig
Configuration for feature plugins in the application.
PluginRegistry
App-scoped registry for managing feature plugins.
Post
Represents a blog post or article with content and metadata.
PostalCode
Represents a postal code with associated location data.
PostListResult
PostRepository
PostSortOption
Represents a post sorting option for list views.
Product
Represents a product in the ecommerce system.
ProductAttribute
Represents a product attribute such as size, color, or material.
ProductAvailability
Represents product availability status and stock information.
ProductFilters
Filters for querying products with pagination, sorting, and search.
ProductListResult
ProductReview
Represents a customer product review with rating and content.
ProductReviewStats
Represents aggregated product review statistics and rating distribution.
ProductSearchResult
Represents search results for products with pagination and facets.
ProductSection
Represents a product content section for organizing product information.
ProductSortOption
Represents a product sorting option for list views.
ProductsRepository
ProductStock
Represents product stock status and inventory information.
ProductTag
Represents a product tag for categorization and filtering.
ProductVariation
Represents a product variation with specific attributes and pricing. Used for variable products where each variation has unique properties.
PromoBanner
Represents a marketing banner or hero promotion that can be displayed inside carousel sections, hero areas, or inline placements.
PushNotification
PushNotificationRepository
Abstract repository for push notification operations
RefundResult
ReviewRepository
ReviewRepository - Abstract interface for review operations
SearchFilters
Filters for search queries across different content types.
SearchRepository
Abstract repository for search functionality Can be implemented for different platforms (WooCommerce, Shopify, etc.)
SearchResult
Represents a unified search result across different content types.
SectionConfig
Configuration for product or content sections.
ShippingInfo
Short
Represents a short-form content item similar to Instagram/Facebook Stories.
ShortsRepository
Repository interface for fetching short-form content (stories).
StoreRepository
Repository for store metadata and configuration.
TextStyleHelper
Helper class for converting JSON to TextStyle objects
UnknownSectionWidget
Diagnostic widget shown in debug mode only when WidgetRegistry cannot find a registered section by name.
User
Represents a user in the system.
UserInteraction
Represents a user interaction action for navigation and deep linking. Supports internal routes, external URLs, and custom action handlers.
VariationSelectorService
WidgetRegistry

Enums

EvictionPolicy
Eviction policy for cache
NotificationPermissionStatus
NotificationPriority
PaymentStatus
SearchResultType
Types of search results supported by the system.
UserInteractionType

Extensions

MooseContextExtension on BuildContext
Convenience extension that adds context.moose to BuildContext.
SearchResultTypeExtension on SearchResultType

Typedefs

BillingAddress = Address
@deprecated Use Address instead. Will be removed in future versions. This alias is provided for backward compatibility.
CustomActionHandler = void Function(BuildContext context, Map<String, dynamic>? parameters)
SectionBuilderFn = FeatureSection Function(BuildContext context, {Map<String, dynamic>? data, void onEvent(String event, dynamic payload)?})
ShippingAddress = Address
@deprecated Use Address instead. Will be removed in future versions. This alias is provided for backward compatibility.
ShippingMethod = DeliveryMethod
@deprecated Use DeliveryMethod instead. Will be removed in future versions. This alias is provided for backward compatibility.
WidgetBuilderFn = Widget? Function(BuildContext context, {Map<String, dynamic>? data, void onEvent(String event, dynamic payload)?})

Exceptions / Errors

AdapterConfigValidationException
Exception thrown when adapter configuration validation fails.
RepositoryFactoryException
Exception thrown when a factory function has an unexpected type.
RepositoryNotRegisteredException
Exception thrown when attempting to get a repository that hasn't been registered.
RepositoryTypeMismatchException
Exception thrown when a cached repository has an unexpected type.