How to Remove the Debug Banner in Flutter

How to Remove the Debug Banner in Flutter

19 December 2024 Stephan Petzl Leave a comment Tech-Help

When developing Flutter applications, you may notice a debug banner displaying in the top right corner of your app. This banner is intended for development purposes, indicating that the app is running in debug mode. However, during development or when taking screenshots, you might want to remove this banner for a cleaner presentation.

Solution: Disable the Debug Banner

The most straightforward method to remove the debug banner in Flutter is by setting the debugShowCheckedModeBanner property to false in your MaterialApp widget. This property controls whether the banner should be displayed, and setting it to false will hide the banner.

Implementation Steps

  1. Open your main Dart file where the MaterialApp is defined.
  2. Locate the MaterialApp widget and set the debugShowCheckedModeBanner property to false as shown below:
    
    MaterialApp(
      debugShowCheckedModeBanner: false,
    )
          
  3. Save the file and perform a hot reload to apply the changes.

Additional Methods

If you are using an Integrated Development Environment (IDE) like Android Studio or Visual Studio Code, you can also manage the debug banner through the IDE’s Flutter Inspector or Dart DevTools. However, these methods may vary based on the tools and versions used, and the primary solution remains the most consistent across various environments.

Running in Release Mode

Another approach to ensure the debug banner is not displayed is to run your app in release mode. This mode is optimized for end-user deployment and automatically suppresses the debug banner:


flutter run --release
    

Leveraging Repeato for Flutter Testing

Testing your Flutter applications without the distraction of a debug banner is crucial for clarity and accuracy. This is where Repeato can be an invaluable tool. As a no-code test automation solution for iOS and Android, Repeato allows you to create, run, and maintain automated tests efficiently. It’s particularly adept at handling Flutter apps, leveraging its computer vision and AI capabilities to streamline the testing process. Whether you’re taking screenshots for documentation or running comprehensive test suites, Repeato ensures that your tests are banner-free and focused on what’s important.

Like this article? there’s more where that came from!