How to remove the Flutter debug banner?

前端 未结 12 546
死守一世寂寞
死守一世寂寞 2020-12-07 11:13

How to remove the debug banner in Flutter?

I am using a flutter screenshot and I would like the screenshot not to have a banner. Now it does have.

相关标签:
12条回答
  • 2020-12-07 11:21

    Well this is simple answer you want.

    MaterialApp(
     debugShowCheckedModeBanner: false
    )
    

    But if you want to go deep with app (Want a release apk (which don't have debug banner) and if you are using android studio then go to

    Run -> Flutter Run 'main.dart' in Relese mode

    0 讨论(0)
  • 2020-12-07 11:23

    MaterialApp( debugShowCheckedModeBanner: false, )

    0 讨论(0)
  • 2020-12-07 11:26

    To remove the flutter debug banner, there are several possibilities :

    1- The first one is to use the debugShowCheckModeBanner property in your MaterialApp widget .

    Code :

    MaterialApp(
      debugShowCheckedModeBanner: false,
    ) 
    

    And then do a hot reload.

    2-The second possibility is to hide debug mode banner in Flutter Inspector if you use Android Studio or IntelliJ IDEA .

    3- The third possibility is to use Dart DevTools .

    0 讨论(0)
  • 2020-12-07 11:28

    On your MaterialApp set debugShowCheckedModeBanner to false.

    MaterialApp(
      debugShowCheckedModeBanner: false,
    )
    

    The debug banner will also automatically be removed on release build.

    0 讨论(0)
  • 2020-12-07 11:31

    There is also another way for removing the "debug" banner from the flutter app. Now after new release there is no "debugShowCheckedModeBanner: false," code line in main .dart file. So I think these methods are effective:

    1. If you are using VS Code, then install "Dart DevTools" from extensions. After installation, you can easily find "Dart DevTools" text icon at the bottom of the VS Code. When you click on that text icon, a link will be open in google chrome. From that link page, you can easily remove the banner by just tapping on the banner icon as shown in this screenshot.

    NOTE:-- Dart DevTools is a dart language debugger extension in VS Code

    1. If Dart DevTools is already installed in your VS Code, then you can directly open the google chrome and open this URL = "127.0.0.1: ZZZZZ/?hide=debugger&port=XXXXX"

    NOTE:-- In this link replace "XXXXX" by 5 digit port-id (on which your flutter app is running) which will vary whenever you use "flutter run" command and replace "ZZZZZ" by your global(unchangeable) 5 digit debugger-id

    NOTE:-- these dart dev tools are only for "Google Chrome Browser"

    0 讨论(0)
  • 2020-12-07 11:34
    • If you are using Android Studio, you can find the option in the Flutter Inspector tab --> More Actions.

    • Or if you're using Dart DevTools, you can find the same button in the top right corner as well.

    0 讨论(0)
提交回复
热议问题