How to check flutter application is running in debug?

后端 未结 9 1129
孤独总比滥情好
孤独总比滥情好 2020-12-08 12:25

I have a short question. I\'m looking for a way to execute code in Flutter when the app is in Debug mode. Is that possible in Flutter? I can\'t seem to find it anywhere in t

9条回答
  •  情歌与酒
    2020-12-08 13:12

    Extracted from Dart Documentation:

    When exactly do assertions work? That depends on the tools and framework you’re using:

    • Flutter enables assertions in debug mode.
    • Development-only tools such as dartdevc typically enable assertions by default.
    • Some tools, such as dart and dart2js, support assertions through a command-line flag: --enable-asserts.

    In production code, assertions are ignored, and the arguments to assert aren’t evaluated.

提交回复
热议问题