Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] How to Configure Package for Different Flavors, Excluding Production #174

Open
wangjacsi opened this issue Apr 15, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request new issue New issue which has not been checked yet

Comments

@wangjacsi
Copy link

I'm currently implementing the Alice package in a Flutter application that operates across multiple environments (development, staging, and production) using flavors. My goal is to integrate Alice for network debugging purposes in development (de) and staging (stg) environments, but I want to ensure that it is not included or activated in the production (prd) environment.

Could anyone provide guidance or examples on how best to configure the Alice package to be excluded from the production flavor? Any best practices or recommendations for managing this kind of environment-specific configuration would be greatly appreciated.

Here’s the basic setup of our Flutter flavors:

Development (de): Uses Alice for in-depth network debugging.
Staging (stg): Similar to Development, includes Alice for final checks before production.
Production (prd): Should not include Alice to avoid unnecessary overhead and potential security concerns.
I am particularly interested in any Flutter-specific approaches or patterns that could be recommended for toggling Alice's activation based on the build flavor.

@wangjacsi wangjacsi added enhancement New feature or request new issue New issue which has not been checked yet labels Apr 15, 2024
@saawhitelife
Copy link

Here is an example project created with very good cli to save time on setting up flavors.

https://github.com/saawhitelife/very_good_alice_flavors-

There is AppInfo singleton in helpers package which reads package info on initialization and then returns a flavor based on the package id suffix.

Then in http_client package we add (or not) alice interceptor to dio basing on the current flavor.

The way very good cli sets up flavors (three entry point files) also allows us to set up AppInfo flavor class field on AppInfo initialization, it can be AppInfo(AppFlavor.dev) and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new issue New issue which has not been checked yet
Projects
None yet
Development

No branches or pull requests

3 participants