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.
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
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.
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,
)
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
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
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(),
);
}
}