How to remove the Flutter debug banner?

前端 未结 12 547
死守一世寂寞
死守一世寂寞 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:34

    While all the above answers have similar approaches, another approach would be to compile the apk as a release build,using flutter build The banner will be automatically removed then The main reason why it is left in the debug build is to indicate so and reminds you not to ship debug builds to production

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

    its app.dart class property,

    Displays a Banner saying "DEBUG" when running in checked mode. MaterialApp builds one of these by default.

    for disable this banner in debug mode also, you can set bool false.

    return MaterialApp(
      theme:....
      debugShowCheckedModeBanner: false,
      home: SplashScreen(),
    );
    

    In release mode this has no effect.

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

    The debug banner appears only while in development and is automatically removed in the release build.

    To hide this there is a need to set debugShowCheckedModeBanner to false

    MaterialApp(
      debugShowCheckedModeBanner: false,
    )
    

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

    If you are using IntelliJ IDEA, there is an option in the flutter inspector to disable it.

    run the project

    open the flutter inspector

    hide slow banner

    When you are in the Flutter Inspector, click or choose "More Actions."

    Picture of the Flutter Inspector

    When the menu appears, choose "Hide Debug Mode Banner"

    Picture of Hide Debug Mode Banner

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

    Here are 3 ways to do it

    • 1 : On your MaterialApp set debugShowCheckedModeBanner to false.

       MaterialApp(
         debugShowCheckedModeBanner: false
       )
      

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

    • 2 : If you are using Android Studio, you can find the option in the Flutter Inspector tab --> More Actions.

    • 3 : 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:

      --> 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 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.

    For more info: How_to_remove_debug_banner_in_flutter_on_android_emulator

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

    You can give simply hide this by giving a boolean parameter-----> debugShowCheckedModeBanner: false,

    void main() {
      Bloc.observer = SimpleBlocDelegate();
    
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          ***debugShowCheckedModeBanner: false,***
          title: 'Prescription Writing Software',
          theme: ThemeData(
            primarySwatch: Colors.blue,
            scaffoldBackgroundColor: Colors.white,
            visualDensity: VisualDensity.adaptivePlatformDensity,
          ),
          home: SplashScreen(),
        );
      }
    }
    
    0 讨论(0)
提交回复
热议问题