A Flutter demo application showcasing the integration and usage of the masterfabric_core package with multiple features including authentication, settings management, and web API demonstrations.
This project demonstrates a production-ready Flutter application structure with:
- Multi-flavor support (Development, Staging, Production)
- State management using flutter_bloc with HydratedBloc for persistence
- Dependency injection via get_it and injectable
- Navigation with go_router
- Core features powered by masterfabric_core package
- π Home: Main dashboard with navigation to all features
- βοΈ Settings: App configuration and preferences management
- π Web APIs: HTTP request testing and API interactions
- π Local Authentication: Biometric authentication support
- π¨ Theme Support: Light/dark mode theming
- πΎ State Persistence: Automatic state saving with HydratedBloc
lib/
βββ app/ # Core application setup
β βββ di/ # Dependency injection configuration
β βββ flavor/ # Flavor configuration and widgets
β βββ app.dart # Main app widget
β βββ routes.dart # Route definitions
βββ features/ # Feature modules
β βββ home/
β βββ settings/
β βββ web_apis/
βββ flavors/ # Flavor entry points
β βββ main_development.dart
β βββ main_staging.dart
β βββ main_production.dart
βββ views/ # UI views for each feature
- Flutter SDK ^3.9.2
- Dart SDK
- Make (for build automation)
# Clone the repository
git clone <repository-url>
cd masterfabric_core_cases
# Run initial setup (installs dependencies, sets up scripts)
make setup
# Run code generation
make codegen
# Generate app icons (optional)
make icons
# Check iOS flavor configuration (macOS only)
make ios-setupNote for iOS: The project includes custom schemes (development, staging, production) for iOS builds. However, you need to configure build configurations in Xcode. Run
make ios-setupfor instructions, or see the iOS Flavor Configuration section below.
# Run development flavor
make run-dev
# Run staging flavor
make run-stg
# Run production flavor
make run-prod# Development
flutter run --flavor development -t lib/flavors/main_development.dart
# Staging
flutter run --flavor staging -t lib/flavors/main_staging.dart
# Production
flutter run --flavor production -t lib/flavors/main_production.dart# Complete pre-build process (clean, setup, codegen, icons)
make prebuild
# Build all flavors (Android & iOS)
make build-all
# Build specific flavors
make build-dev # Development
make build-stg # Staging
make build-prod # ProductionRun make help to see all available commands:
make setup- Initial project setupmake ios-setup- Configure iOS flavors (requires Xcode)make ios-test- Test iOS flavor configurationmake test-scripts- Run unit tests for build scriptsmake clean- Clean build artifactsmake codegen- Run code generationmake icons- Generate app iconsmake prebuild- Complete pre-build processmake run-dev/stg/prod- Run specific flavormake build-dev/stg/prod- Build specific flavormake build-all- Build all flavors
π‘ Testing: See TESTING.md for comprehensive testing documentation and troubleshooting.
- masterfabric_core ^0.0.4 - Core functionality package
- flutter_bloc ^9.1.0 - State management
- go_router ^15.1.3 - Navigation
- get_it ^8.3.0 - Service locator
- injectable ^2.5.0 - Code generation for dependency injection
- dio ^5.7.0 - HTTP client
- local_auth ^2.3.0 - Biometric authentication
- shared_preferences ^2.3.4 - Local storage
Flavor configurations are managed through:
assets/flavor_config.yaml- YAML-based flavor settingsassets/flavor_config.json- JSON-based flavor settingsassets/app_config.json- Application-wide configuration
This project uses code generation for:
- Dependency injection (injectable_generator)
- JSON serialization (json_serializable)
- Immutable models (freezed)
Run make codegen or flutter pub run build_runner build --delete-conflicting-outputs after modifying annotated classes.
- Create feature folder in
lib/features/ - Add corresponding view in
lib/views/ - Register routes in
lib/app/routes.dart - Add dependencies if needed in
lib/app/di/
flutter test- MasterFabric Core Documentation
- Flutter Documentation
- go_router Documentation
- flutter_bloc Documentation
The project requires flavor-specific build configurations in Xcode for iOS builds. Follow these steps to set them up:
-
Open the iOS project in Xcode:
open ios/Runner.xcworkspace
-
Click on Runner in the project navigator (the blue icon at the top)
-
Make sure you select the Runner PROJECT (not the Runner target)
-
Under Info tab, expand Configurations
-
For each flavor (development, staging, production), duplicate the Debug configuration:
- Click the + button below the configurations list
- Select Duplicate "Debug" Configuration
- Name it:
Debug-development,Debug-staging,Debug-production
-
Repeat for Release configurations:
- Duplicate "Release" Configuration three times
- Name them:
Release-development,Release-staging,Release-production
-
Repeat for Profile configurations:
- Duplicate "Profile" Configuration three times
- Name them:
Profile-development,Profile-staging,Profile-production
If you don't need flavor-specific configurations for iOS, you can run without the --flavor flag:
# Run on iOS without flavor
flutter run -t lib/flavors/main_development.dart
# For other flavors
flutter run -t lib/flavors/main_staging.dart
flutter run -t lib/flavors/main_production.dartAfter setting up the configurations, you can test them:
make ios-testThis will verify:
- β All scheme files exist and are valid
- β Build configurations are properly set up
- β Project structure is correct
If all tests pass, you can run:
make run-dev # or run-stg, run-prodThe custom schemes (development, staging, production) are already configured in the project. The custom schemes (development, staging, production) are already configured in the project.