Set Icon, URL, and App Name Based on App Flavor

Set Icon, URL, and App Name Based on App Flavor

When we develop applications, we often work with different URLs like dev URL or prod URL. In some cases, there might also be a staging URL.

Personally, I prefer splitting into three categories: dev, staging, and prod.

In Flutter, we can use the flutter_flavorizr package to separate app flavors. For Android, you can customize the applicationId, and for iOS, you can modify the bundleID as you prefer. There are many other options available as well.

The flutter_launcher_icons package is used for App Icons.

With flutter_launcher_icons, based on the flavors defined, you can create a YAML file for each flavor and change the App Icon accordingly: flutter_launcher_icons-<flavor_name>.yaml

For more details, you can check the documentation on pub.dev.

Feel free to point out any mistakes or share in the comments if you know a better way!


Here is sample repo.

https://github.com/KyawSoeW1n/env_flavor

Configuration For Flutter Launcher Icons

Lastly, there’s flutter_dotenv.

I use it when I want to manage things like BASE_URL or toggle features on and off. Sometimes, in development, I want to show everything, but in production, I might not want to display certain things. So, I use a flag for that (P.S. It’s better if you can decide from the beginning whether to include it in prod or not).

Sample for env File


Result for 4 flavors


要查看或添加评论,请登录

Kyaw Soe Win的更多文章

  • What are feature flag?

    What are feature flag?

    Feature flags are settings in an app’s code that act like switches, allowing you to turn specific features on or off…

  • Secret Files in Github Actions

    Secret Files in Github Actions

    When working with sensitive files like in a public repository (where anyone can see your code), it's generally not…

    4 条评论
  • Localization For Android Applications

    Localization For Android Applications

    Are you still using library or write too much code to change locale for android application? If yes, I would like to…

  • Dependency Injection for Android

    Dependency Injection for Android

    Today, dependency injection is widely adopted across various programming languages and platforms, including Java…

  • Deep Linking ?????????

    Deep Linking ?????????

    Deep Linking ????? User ????????? Action ????????????????? ????????? ?????????? Website ???????? Application Screen…

社区洞察

其他会员也浏览了