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

Add Support for Flutter Flavors to the Template #11

Open
Erengun opened this issue Nov 7, 2023 · 0 comments
Open

Add Support for Flutter Flavors to the Template #11

Erengun opened this issue Nov 7, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Erengun
Copy link
Owner

Erengun commented Nov 7, 2023

Hello everyone,

Firstly, thank you for your interest and contributions to this Flutter boilerplate template. We've received a suggestion to add support for Flutter flavors to our template, and we think it's a great idea!

For those unfamiliar, Flutter flavors are build configurations that allow us to create separate environments for the same application using the same code base. This is particularly useful when we need to create multiple versions of an app, such as a development version, a production version, or different versions for different clients. These flavors can be customized to have different API endpoints, resources, app icons, and more, without duplicating the codebase. You can read more about it here.

Here's a brief overview of what needs to be done:

  1. Set up the Environment: Define build configurations in Xcode for iOS and specify the flavor in the build command for Android.

    Example for iOS:

    project 'Runner', {
      'Debug-free' => :debug,
      'Profile-free' => :release,
      'Release-free' => :release,
    }
    

    Example for Android:

    /// iOS build command
    flutter build ios --release --flavor flavorName stage -t lib/main_flavorName.dart
    
    // android build command
    flutter build apk  --target-platform android-arm,android-arm64,android-x64 --split-per-abi --flavor flavorName -t lib/main_flavorName.dart
    
  2. Define Flavor-Specific Configurations: Customize various aspects of the app, including API endpoints, resources, app icons, and more, without duplicating the codebase.

  3. Testing: Run the app with the desired flavor using the flutter run command with the --flavor option.

    flutter run --flavor development --target lib/main_development.dart
    flutter run --flavor staging --target lib/main_staging.dart
    flutter run --flavor production --target lib/production.dart
    

We believe this would be a valuable addition to our template, making it more flexible and adaptable to various development scenarios. If anyone is interested in taking on this task, please feel free to comment below or submit a pull request. We appreciate all contributions and look forward to seeing this feature implemented!

Best,

@Erengun Erengun added the enhancement New feature or request label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant