Skip to main content

flutter_prakash_core 1.0.10 copy "flutter_prakash_core: ^1.0.10" to clipboard
flutter_prakash_core: ^1.0.10 copied to clipboard

Enterprise-grade Flutter core package & hybrid plugin framework with Clean Architecture, BLoC state management, reactive forms, DevTools, and monetization.

example/README.md

flutter_prakash_core_example πŸ“±βœ¨ #

Flutter Clean Architecture License: MIT

A production-grade, enterprise sample application demonstrating the complete capabilities of flutter_prakash_core and flutter_prakash_ads. Built adhering strictly to Clean Architecture (no domain layer, direct concrete data sources & repositories), SOLID principles, and reactive form management. πŸ—οΈβš‘


🌟 What This Example Showcases #

  • ⚑ BLoC State Management:
    • BaseUiCubit & UiState lifecycle (initial, loading, success, failure).
    • BaseFormCubit & Field<T> with declarative chained Validators.
    • BasePagingCubit for infinite scrolling lists with pull-to-refresh & optimistic item deletion.
    • FpEventTransformers.debounce for 300ms real-time search inputs.
    • FpEffectListener for single-shot UI side-effects (toasts, navigation).
  • πŸ” Full Authentication Suite (features/auth/):
    • Login: Email & password validation, remember me, and social buttons.
    • Register: Full name, email, password strength, match verification, terms consent.
    • Forgot Password: Email submission to dispatch a 6-digit recovery OTP code.
    • Email Verification: 6-digit ReactivePinCodeField with a 60s countdown timer & resend.
    • Reset Password: OTP verification with new password configuration.
    • Change Password: In-app security settings flow.
  • πŸ’° Monetization & AdMob Integration (flutter_prakash_ads):
    • Automated AdManager initialization and GDPR/UMP consent management.
    • Adaptive BannerAdView.
    • SmartNativeAdView (Small 90px and Medium 350px templates).
    • AdMobShowcasePage demonstrating Interstitial, Rewarded, and Rewarded Interstitial ads with live ILRD telemetry.
  • πŸ› οΈ DevTools Floating Dock:
    • Draggable in-app overlay dock (DevtoolsFloatingDock) giving instant access to the DevTools inspector from any screen in dev mode.
    • Network requests, SharedPreferences, local file storage, and ANSI logs.
  • 🎭 Theme & Localization:
    • Dynamic system/light/dark theme switching (ThemeCubit).
    • Multi-language support (LocaleCubit with English, Hindi, and Nepali).
  • 🍞 Zero-Context Overlays & Universal Pages:
    • Global toasts (Toast.success, Toast.error, Toast.warning, Toast.info).
    • Full-screen loading overlay (LoadingOverlay.show() / LoadingOverlay.hide()).
    • Media preview (FilePreviewPage for image zoom & PDF viewing).
    • In-app web browser (InAppWebViewPage with progress bar & action controls).
    • User feedback submission (FeedbackPage with reactive validation).
  • πŸ—ΊοΈ Type-Safe Navigation:
    • AutoRoute with route guards (ExampleAuthGuard).
    • Splash screen dynamic routing based on session tokens and onboarding state.

πŸš€ Getting Started #

1. Install Dependencies #

flutter pub get

2. Run Code Generation (if modifying routes, models, or DI) #

dart run build_runner build --delete-conflicting-outputs

3. Launch App (Flavours) #

# Run Development Flavour
flutter run -t lib/main_dev.dart --flavor dev --dart-define-from-file=.env.dev

# Run Production Flavour
flutter run -t lib/main_prod.dart --flavor prod --dart-define-from-file=.env.prod

πŸ“‚ Project Architecture #

example/lib/
β”œβ”€β”€ app.dart                               # Root app with ThemeCubit, LocaleCubit, AuthCubit, & DevtoolsFloatingDock
β”œβ”€β”€ bootstrap.dart                         # Global error logger, EnterpriseBlocObserver, Ads initialization
β”œβ”€β”€ main.dart                              # Default entrypoint
β”œβ”€β”€ main_dev.dart                          # Dev flavour entrypoint
β”œβ”€β”€ main_prod.dart                         # Prod flavour entrypoint
β”œβ”€β”€ config/                                # App-wide static configuration
β”‚   β”œβ”€β”€ constants/app_constants.dart       # App versions, timeouts, storage keys
β”‚   β”œβ”€β”€ envs/ (app_env.dart, env_dev.dart, env_prod.dart, envs.dart)
β”‚   β”œβ”€β”€ themes/ (app_colors.dart, app_theme.dart)
β”‚   └── config.dart                        # Barrel file
β”œβ”€β”€ core/                                  # Common utilities & system singletons
β”‚   β”œβ”€β”€ ads/ (ads.dart, my_ad_service.dart, cubit/ads_cubit.dart)
β”‚   β”œβ”€β”€ di/ (injection.dart, register_module.dart)
β”‚   β”œβ”€β”€ l10n/ (l10n.dart)
β”‚   β”œβ”€β”€ router/ (app_router.dart, app_router.gr.dart, guards/auth_guard.dart)
β”‚   └── core.dart                          # Barrel file
└── features/
    β”œβ”€β”€ splash/                            # App launch, initialization, version check
    β”‚   β”œβ”€β”€ data/
    β”‚   β”‚   β”œβ”€β”€ datasources/
    β”‚   β”‚   β”œβ”€β”€ models/
    β”‚   β”‚   └── repositories/
    β”‚   └── presentation/
    β”‚       β”œβ”€β”€ blocs/
    β”‚       β”œβ”€β”€ pages/
    β”‚       └── widgets/
    β”œβ”€β”€ onboarding/                        # Intro slides, initial setup screens
    β”‚   β”œβ”€β”€ data/
    β”‚   β”‚   β”œβ”€β”€ datasources/
    β”‚   β”‚   β”œβ”€β”€ models/
    β”‚   β”‚   └── repositories/
    β”‚   └── presentation/
    β”‚       β”œβ”€β”€ blocs/
    β”‚       β”œβ”€β”€ pages/
    β”‚       └── widgets/
    β”œβ”€β”€ auth/                              # Auth: login, register, forgot/reset password, email verification
    β”‚   β”œβ”€β”€ data/
    β”‚   β”‚   β”œβ”€β”€ datasources/
    β”‚   β”‚   β”œβ”€β”€ models/
    β”‚   β”‚   └── repositories/
    β”‚   └── presentation/
    β”‚       β”œβ”€β”€ blocs/
    β”‚       β”œβ”€β”€ pages/
    β”‚       └── widgets/
    β”œβ”€β”€ dashboard/                         # Core app experience & main navigation hub
    β”‚   β”œβ”€β”€ data/
    β”‚   β”‚   β”œβ”€β”€ datasources/
    β”‚   β”‚   β”œβ”€β”€ models/
    β”‚   β”‚   └── repositories/
    β”‚   └── presentation/
    β”‚       β”œβ”€β”€ blocs/
    β”‚       β”œβ”€β”€ pages/
    β”‚       └── widgets/
    β”œβ”€β”€ settings/                          # User preferences, app info, notification toggles
    β”‚   β”œβ”€β”€ data/
    β”‚   β”‚   β”œβ”€β”€ datasources/
    β”‚   β”‚   β”œβ”€β”€ models/
    β”‚   β”‚   └── repositories/
    β”‚   └── presentation/
    β”‚       β”œβ”€β”€ blocs/
    β”‚       β”œβ”€β”€ pages/
    β”‚       └── widgets/
    └── common/                            # Universal utility screens used across features
        β”œβ”€β”€ data/
        β”‚   β”œβ”€β”€ datasources/
        β”‚   β”œβ”€β”€ models/
        β”‚   └── repositories/
        └── presentation/
            β”œβ”€β”€ blocs/
            β”œβ”€β”€ pages/
            β”‚   β”œβ”€β”€ file_preview/
            β”‚   β”œβ”€β”€ inapp_webview/
            β”‚   β”œβ”€β”€ privacy_policy/
            β”‚   β”œβ”€β”€ terms_and_conditions/
            β”‚   └── feedback/
            └── widgets/

πŸ§ͺ Quality & Verification #

# Analyze Example Code
flutter analyze

# Analyze Core Engine
cd .. && flutter analyze

# Run Full Test Suite
flutter test

πŸ“„ License & Authors #

Crafted with ❀️ by Prakash Bahadur Chand. Licensed under the MIT License.