Skip to content

How to Remove the Debug Ribbon in Flutter

Flutter, Debugging1 min read

When developing applications using Flutter, the debug ribbon can be incredibly useful for identifying issues and understanding the state of your app. However, when it comes to showcasing your app for demonstrations or releases, you might want to remove the debug ribbon for a cleaner, more professional appearance. In this article, we will walk through the steps to remove the debug ribbon in Flutter, along with some examples to guide you through the process.

Understanding the Debug Ribbon

The debug banner, also known as the debug ribbon, is a striped banner that appears at the top right corner of the app when running in debug mode. It contains the word "DEBUG" written diagonally, making it easily visible during development. While this feature is immensely valuable for developers to quickly identify if an app is running in debug mode, it may not be desirable in a production environment or when demonstrating the application to clients or stakeholders.

Removing the Debug Ribbon

To remove the debug ribbon from your Flutter application, you can modify the main entry point of your app. Follow these simple steps to achieve a clean interface without the debug ribbon:

  1. Open the main entry file of your Flutter app, typically named main.dart.
  2. Locate the void main() function, which serves as the entry point of your application.
  3. Within the void main() function, add the following line of code:
1debugShowCheckedModeBanner: false,

Here's an example of how the modified void main() function would look:

1void main() {
2 runApp(
3 MaterialApp(
4 home: MyApp(),
5 debugShowCheckedModeBanner: false,
6 ),
7 );

By setting debugShowCheckedModeBanner to false, you instruct Flutter to no longer display the debug ribbon when running the application.

Complete Example

Let's consider a complete example to illustrate how to remove the debug ribbon from a Flutter application. Assume we have a simple Flutter app with the following structure:

1import 'package:flutter/material.dart';
3void main() {
4 runApp(
5 MaterialApp(
6 home: Scaffold(
7 appBar: AppBar(
8 title: Text('Debug Ribbon Removal'),
9 ),
10 body: Center(
11 child: Text('Hello, Flutter!'),
12 ),
13 ),
14 debugShowCheckedModeBanner: false,
15 ),
16 );

In this example, after setting debugShowCheckedModeBanner to false, the debug ribbon will no longer be displayed when running the app.

Summing Up

Removing the debug ribbon in a Flutter application is a straightforward process that can provide a more polished and professional appearance to your app. By following the simple steps outlined in this article, you can easily hide the debug ribbon while retaining all the benefits of Flutter's powerful debugging features during development.