Skip to main content

How to identify release mode in Flutter with kReleaseMode

Find whether the Flutter application compiled in release mode or not is very important in some cases in flutter development. In my case, I wanted to avoid the Red Screen Of Death by showing a custom error handler widget. But I only want it shown for release builds only.

How we find, our app is in release mode?

The easiest way is to use kReleaseMode constant in the flutter constants. This constant is true if the application was compiled in release mode.



Since this is a const value, it can be used to indicate to the compiler that a particular block of code will not be executed in release mode, and hence can be removed. So it's an another advantage of using this constant. 

Happy Coding!

Comments

  1. Thank you for putting all these strategies into a very readable place. It shows your ability and great skills. keep sharing such article in future. Best Mobile App Development Services

    ReplyDelete
  2. Very well written article. It was an awesome article to read. about Android Native App Development Dubai Complete rich content and fully informative. I totally Loved it.

    ReplyDelete
  3. Since malware is increasingly rising of angry birds go mod apk unlimited gems for the Android platform day by day, you must pay firm attention to what is going on your phone or tablet. Smartphones are basically computers - and all PCs are at risk to viruses, phishing, including various attacks from malicious software.

    ReplyDelete
  4. Casino Games - MapYRO
    Slots: 오산 출장마사지 A 안성 출장마사지 map of a slot machine in a slot 강원도 출장마사지 machine. Where to find the closest 나주 출장안마 Casino Game to you? Find it HERE! Play all of your 정읍 출장마사지 favorite

    ReplyDelete
  5. Plato MOD APK this app will allow you to play all the latest games for free Download Plato MOD APK latest version with unlimited money, mod menu 2022.

    ReplyDelete
  6. The most popular direct viewing site for entertainment and English series is Sdarot TV. It is the largest series database in the country and no other competitor can match its size.

    ReplyDelete

Post a Comment

Popular posts from this blog

Run Flutter UI tests in CircleCI

Flutter allows you to create UI tests with Flutter Deriver. By creating UI tests and automate UI test execution helps to identify most of the UI issues even before QA testing. That helps to reduce a lot of time that has to spend on testing. To run UI tests you need emulators or remotely accessible devices.    You may aware that running the Android emulator is not currently supported on CircleCI 2.0, since it's not supported by the type of virtualization CircleCI uses on Linux. So they are suggesting to use external service like Firebase TestLab. If you developed your app with Flutter then Firebase TestLab is not an option since Firebase TestLab not supports for flutter test UI execution. For my recent flutter project, I needed to configure CircleCI for Flutter UI test execution. Even CircleCI Linux instance, not support for the android emulator, with MacOS instance we can run the emulator. Since we can build both Android and iOS builds in MacOS instance it's worth givi

Add read more/ less to Android TextView

In this quick article, I’m going to show you how to add read more/ less components to android TextView. Finally, your text view looks like this.