multi_app_flavor 0.0.1
multi_app_flavor: ^0.0.1 copied to clipboard
A dedicated Flutter package to manage multi-tenant applications (flavors) with custom configurations, themes, and modular entry points.
Multi App Flavor #
A Flutter package to easily manage multi-tenant applications (Flavors) with support for custom configurations, themes, and assets per flavor.
Repository: https://github.com/kedirinesia/Multi-App-Flavor
Features #
- Singleton Configuration: Easy access to current flavor state anywhere in the app.
- Flavor Independent UI: Build unrelated UI components for different apps using
FlavorBuilder. - Visual Indicator:
FlavorBannerto show current environment (Dev/Staging) on top of the app. - Custom Values: Store API endpoints, API Keys, and other constants specific to a flavor.
Getting Started #
- Add dependency to
pubspec.yaml:
dependencies:
multi_app_flavor:
path: ./ # or git/pub path
- Initialize
FlavorConfigin yourmain.dart(create separate main files for each flavor):
lib/main_app1.dart
void main() {
FlavorConfig(
flavor: Flavor.app1,
name: 'Application 1',
color: Colors.blue,
values: {
'baseUrl': 'https://app1.com/api',
},
);
runApp(MyApp());
}
- Use
FlavorBuilderin your code:
FlavorBuilder(
onApp1: (_) => App1Logo(),
onApp2: (_) => App2Logo(),
orElse: (_) => DefaultLogo(),
)
Running Flavors #
Run the specific target file:
flutter run -t lib/apps/app1/main.dart
flutter run -t lib/apps/app2/main.dart