I'm using flutter screenshot and I expected the screenshot to not have a banner, but it has.
Note that I get a not supported for emulator message for profile and release mode.
On your MaterialApp set debugShowCheckedModeBanner to false.
MaterialApp(
debugShowCheckedModeBanner: false,
)
The debug banner will also automatically be removed on the release build.
return new MaterialApp( home: new LoginPage(), debugShowCheckedModeBanner: false, theme: new ThemeData( primarySwatch: Colors.green, ));debugShowCheckedModeBanner: false on each class means activity ?flutter tool's built-in screenshot command also knows how to automatically remove the "debug" banner while taking a screenshot if that's helpful.Outdated
Well, this is the simple answer you want.
MaterialApp(
debugShowCheckedModeBanner: false
)
CupertinoApp(
debugShowCheckedModeBanner: false
)
But if you want to go deep with the app (want a release APK file (which doesn't have a debug banner) and if you are using Android Studio then go to Run → Flutter → Run 'main.dart' in Release mode.
If you are using IntelliJ IDEA, there is an option in the Flutter Inspector to disable it.
Run the project:
When you are in the Flutter Inspector, click or choose "More Actions."
When the menu appears, choose "Hide Debug Mode Banner":
Snippet
MaterialApp(
debugShowCheckedModeBanner: false,
)
OR
ScaffoldApp(
debugShowCheckedModeBanner: false,
);
For running release version of your app, use this command
flutter run --release
Or if using real devices rather than emulators or simulators.
make a build version of the app.
flutter build apk
IN vs code type ctr+shift+pin windows and for mac cmd+shift+p and use this command to open dart dev tool
Dart: Open DevTools
There is also another way for removing the "debug" banner from the Flutter app. Now after a new release there is no "debugShowCheckedModeBanner: false," code line in the main .dart file. So I think these methods are effective:
NOTE: Dart DevTools is a Dart language debugger extension in Visual Studio Code
Note: In this link, replace "XXXXX" by 5 digit port-id (on which your Flutter app is running) which will vary whenever you use the flutter run command and replace "ZZZZZ" by your global (unchangeable) 5 digit debugger-id
Note: These Dart developer tools are only for the Google Chrome browser
On your MaterialApp set debugShowCheckedModeBanner to false.
MaterialApp(
debugShowCheckedModeBanner: false,
)
The debug banner will also automatically be removed on release build.
If you are using emulator or real device and you want to check it on release mode then =>
flutter run release --apk
run this command on terminal Android Studio / Vs Code
To remove the Flutter debug banner, there are several possibilities:
The first one is to use the debugShowCheckModeBanner property in your MaterialApp widget.
Code:
MaterialApp(
debugShowCheckedModeBanner: false,
)
And then do a hot reload.
The second possibility is to hide debug mode banner in Flutter Inspector if you use Android Studio or IntelliJ IDEA.
The third possibility is to use Dart DevTools.
It's the app.dart class property.
It displays a banner, saying "DEBUG" when running in checked mode. MaterialApp builds one of these by default.
For disabling this banner in debug mode also, you can set a Boolean false.
return MaterialApp(
theme:....
debugShowCheckedModeBanner: false,
home: SplashScreen(),
);
In release mode this has no effect.
If you use Scaffold in Return Section so add on Top MaterialApp and Restart
void main() => runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Home()),
);
This is the simplest way.
For : MaterialApp( debugShowCheckedModeBanner: false )
For : CupertinoApp( debugShowCheckedModeBanner: false )
If you are logically handle another flutter components them you use a bool variable & handle it. For Example bool isDebug === false ;
if(isDebug == true) { debugShowCheckedModeBanner: true }
else { debugShowCheckedModeBanner: false }
Thanks & Enjoy)):
If you are using the Material library
MaterialApp(
debugShowCheckedModeBanner: false
)
If you are using the GetX library
GetMaterialApp(
debugShowCheckedModeBanner: false
)
If you are using the Cupertino library
CupertinoApp(
debugShowCheckedModeBanner: false
)
add debugShowCheckedModeBanner: false, into the materialApp Widget.
MaterialApp(
debugShowCheckedModeBanner: false
)