Reputation: 31401
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.
Upvotes: 811
Views: 435546
Reputation: 90
If you're seeing the debug banner (DEBUG
) in your Flutter app and want to remove it, you can do so by setting the debugShowCheckedModeBanner
property of the MaterialApp
(or CupertinoApp
) widget to false
.
Example:
MaterialApp(
debugShowCheckedModeBanner: false, // Hides the debug banner
home: YourHomePage(),
)
Why is the Debug Banner Appearing in Screenshots?
The debug banner appears because the app is running in debug mode. This banner is Flutter's way of indicating that the app isn't running in production.
If you're taking screenshots and don't want the banner:
debugShowCheckedModeBanner
to false
: This removes the banner while staying in debug mode.Profile
flutter run --profile
Release
flutter run --release
Note: Profile and release modes aren't supported on emulators. You'll need a physical device for these modes.
Additional Tips:
If you still need to take screenshots programmatically, you can use a package like flutter_native_screenshot
to capture the UI without debug banners.
Let me know if you need more help!
Upvotes: 1
Reputation: 67
add debugShowCheckedModeBanner: false, into the materialApp Widget.
MaterialApp(
debugShowCheckedModeBanner: false
)
Upvotes: 0
Reputation: 724
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
)
Upvotes: 3
Reputation: 3883
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+p
in windows and for mac cmd+shift+p
and use this command to open dart dev tool
Dart: Open DevTools
Upvotes: 42
Reputation: 277567
On your MaterialApp
set debugShowCheckedModeBanner
to false
.
MaterialApp(
debugShowCheckedModeBanner: false,
)
The debug banner will also automatically be removed on the release build.
Upvotes: 1554
Reputation: 57
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)):
Upvotes: 3
Reputation: 1291
If you use Scaffold
in Return Section so add on Top MaterialApp
and Restart
void main() => runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Home()),
);
Upvotes: 8
Reputation: 5859
If you are still in debug mode, you can switch to release mode and the banner will be gone.
You can also open the same Run/Debug Configurations window via shortcuts:
ALT+SHIFT+F10, then Press 0 and Press ALT+a.
Now enter --release
.
Upvotes: 10
Reputation: 1398
All other answers are great for Android Studio, but if using Visual Studio Code there is a command you can use to toggle this easily. Open the command palette (Mac: Cmd + Shift + P or Windows: Ctrl + Shift + P). Then type toggle debug-mode banner as shown below:
Upvotes: 18
Reputation: 1865
Use:
MaterialApp(
debugShowCheckedModeBanner: false,
)
This is the code for removing this banner. The debug banner is due to MaterialApp, e.g., you can see this banner on all that pages that use MaterialApp.
There should be at least one MaterialApp in your app on main root.
Upvotes: 18
Reputation: 7289
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.
Upvotes: 23
Reputation: 5993
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.
Upvotes: 10
Reputation: 1547
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.
Upvotes: 82
Reputation: 2352
Outdated
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.
Upvotes: 130
Reputation: 429
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
Upvotes: 32
Reputation: 1174
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":
Upvotes: 52
Reputation: 674
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
Upvotes: 23
Reputation: 7105
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,
)
Upvotes: 45