services library

Services and utilities for moose_core package.

This module exports business services, helpers, registries, and utilities used throughout the application.

Event Systems

This module provides two complementary event systems:

  • HookRegistry: Synchronous callback system for data transformation

    • Use when you need to modify/transform data
    • Callbacks can return modified values
    • Execution order controlled by priority
    • Example: Transform product prices, filter search results
  • EventBus: Asynchronous pub/sub system for notifications

    • Use for fire-and-forget notifications and side effects
    • String-based events using dot notation (e.g., 'cart.item.added')
    • Multiple subscribers can listen to same event
    • Example: Track analytics, send notifications, update cache

See EVENT_SYSTEM_COMPARISON.md for detailed comparison and usage guide.

Classes

ActionRegistry
ApiClient
Advanced API client with comprehensive features
AppLogger
Simple logger utility for the application
AppNavigator
Centralized navigation service that uses EventBus for decoupled navigation.
ColorHelper
Helper class for color operations and conversions
ConfigManager
CurrencyFormatter
Helper class for formatting monetary values consistently across the app.
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
Hook
HookRegistry
TextStyleHelper
Helper class for converting JSON to TextStyle objects
VariationSelectorService

Typedefs

CustomActionHandler = void Function(BuildContext context, Map<String, dynamic>? parameters)