⚡ TL;DR
Learn how to remove the debug banner in Flutter apps. Follow step-by-step techniques and best practices for a polished user experience.
Introduction
When developing Flutter applications, it is common to see a red “DEBUG” banner at the top right corner of the screen. While this banner is useful during the development phase, it is not desirable when sharing builds with testers or clients. Removing the debug banner is a small step that goes a long way toward a polished and professional user experience. In this tutorial, we will explore the best practices and techniques for removing the debug banner in Flutter applications.
First, an important fact that clears up a lot of confusion: the debug banner only ever appears in debug builds. Release and profile builds never show it, no matter what debugShowCheckedModeBanner is set to. So “removing the debug banner from production” is automatic — the flag below only affects what you (and your testers on flutter run builds) see during development.
Prerequisites
Before we proceed, ensure that you have the following prerequisites in place:
- Flutter SDK installed on your machine.
- A Flutter project set up and ready for development.
Step 1: Remove Debug Banner with debugShowCheckedModeBanner
To hide the banner in debug builds, set debugShowCheckedModeBanner to false on your MaterialApp (or CupertinoApp). Follow these steps:
- Open the lib/main.dart file in your Flutter project.
- Locate the MaterialApp widget that wraps your application.
- Add the
debugShowCheckedModeBannerproperty to the MaterialApp widget and set it to false.
Here’s an example:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false, // Add this line
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Banner Demo')),
body: const Center(child: Text('No banner here')),
);
}
}Placement matters: debugShowCheckedModeBanner is a property of the MaterialApp widget itself (or WidgetsApp/CupertinoApp) — it does not belong on the Scaffold, the AppBar, or your home page. Setting it anywhere other than the app-level widget has no effect.
With debugShowCheckedModeBanner set to false, the banner will not be displayed during development, and it was never going to appear in your release build anyway.
Step 2: Toggling the Banner Conditionally (Debug vs Release)
If you want the banner on in development but off in builds you hand to testers, gate the flag with kDebugMode:
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
Widget build(BuildContext context) {
return MaterialApp(
// true only in debug builds; release and profile builds
// never render the banner regardless of this value.
debugShowCheckedModeBanner: kDebugMode,
home: const MyHomePage(),
);
}
}kDebugMode is a compile-time constant from package:flutter/foundation.dart, so this branch is resolved at build time — there is no runtime cost.
Bonus: What About Build Flavors?
A common misconception is that build flavors are configured in pubspec.yaml. They are not — Flutter has no flavor support in pubspec. Android flavors are defined in Gradle (android/app/build.gradle) and iOS schemes in Xcode, then selected with the --flavor flag. For example, on Android:
// android/app/build.gradle
android {
flavorDimensions "env"
productFlavors {
dev {
dimension "env"
applicationIdSuffix ".dev"
}
prod {
dimension "env"
}
}
}Then run or build with:
flutter run --flavor dev
flutter build apk --flavor prod --releaseFlavors control which backend, app ID, and assets are used — they do not affect the debug banner. A debug-mode build of any flavor shows the banner; a release build of any flavor never does. If your goal is a “clean” build for testers without shipping a full release, use flutter run --profile or a release build.
Conclusion
In this tutorial, we have learned how to remove the debug banner in Flutter applications. The key takeaways: set debugShowCheckedModeBanner: false on your MaterialApp to hide the banner during development, remember that release builds never show it in the first place, and keep build flavors in Gradle/Xcode — not pubspec.yaml. By following these best practices, you can ensure that your Flutter app provides a seamless and professional user experience.
Remember to thoroughly test your application after removing the debug banner to confirm that everything functions as expected. Happy coding!
Related Posts
- Enhancing File Manipulation in Flutter: Best Practices and Examples
- How to Show Automatic Internet Connection Offline Message in Flutter
- A Comprehensive Guide to Flutter Buttons: Choosing the Right One for Your App
- How to Change minSdkVersion in Flutter: 2 Simple Approaches
References
- MaterialApp debugShowCheckedModeBanner property — Flutter API docs
- kDebugMode constant — Flutter API docs
- Flutter build modes — Flutter docs
- Flutter flavors (Android and iOS) — Flutter docs
- MaterialApp class — Flutter API docs
FAQ
How do I remove the debug banner in Flutter?
Set debugShowCheckedModeBanner to false on your MaterialApp or CupertinoApp widget in lib/main.dart. This hides the red DEBUG ribbon in the top-right corner during development. Note that release and profile builds never show the banner regardless of this flag, so no change is needed for production — the setting only affects debug builds.
Does the Flutter debug banner appear in release builds?
No. The debug banner only ever renders in debug builds; release and profile builds never display it no matter what debugShowCheckedModeBanner is set to. That means “removing the debug banner from production” happens automatically, and the property only controls what you or testers running flutter debug builds see during development.
Where should debugShowCheckedModeBanner be placed in Flutter?
debugShowCheckedModeBanner is a property of the app-level widget — MaterialApp, CupertinoApp, or WidgetsApp — placed in your root widget, typically in main.dart. Setting it on the Scaffold, AppBar, or any inner page has no effect. If the banner persists after adding the flag, verify it is on the outermost app widget rather than a child.
Are Flutter build flavors configured in pubspec.yaml?
No. Flutter has no flavor support in pubspec.yaml. Android flavors are defined in android/app/build.gradle under productFlavors, and iOS flavors are configured as Xcode schemes, then selected with the —flavor flag when running or building. Flavors control backend, app ID, and assets — they do not affect the debug banner, which depends only on build mode.

Written by Mihir Pipermitwala
Senior Full Stack Consultant & Mobile Engineering Specialist building user-focused applications in healthcare with Flutter, Dart and React Native. I write about what I actually build and test — every tutorial here comes from real project work.
More about Mihir →