Flutter Tricks
Published on

How to Remove the Debug Banner in a Flutter Application

When developing a Flutter application, you may have noticed a small "debug" banner displayed on the top-right corner of your app's screen. This debug banner serves as a visual indicator that your app is running in debug mode, which can be useful for developers during the development and testing phase. However, when you're ready to release your app to the public or showcase it to clients, you may want to remove this debug banner to create a more professional and polished user experience. In this article, we will explore how to remove the debug banner from a Flutter application.

Step 1: Update the MaterialApp Widget

The debug banner is displayed by default when using the MaterialApp widget. To remove it, you need to update the MaterialApp widget by setting the debugShowCheckedModeBanner property to false. Here's an example:

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomeScreen(),
    );
  }
}

By setting debugShowCheckedModeBanner to false, the debug banner will no longer be displayed in the app.

Step 2: Hot Reload or Restart the Application

After making the necessary changes to the MaterialApp widget, you will need to hot reload or restart your application for the changes to take effect. If you are using a development tool like VS Code or Android Studio, you can simply trigger a hot reload by saving the changes or using the hot reload button. If you are running the app from the command line, you can restart the app to see the updated changes.

That's it! With these two simple steps, you can remove the debug banner from your Flutter application. Remember to perform this step before releasing your app to the public or showcasing it to clients to ensure a more professional and polished user experience.

Whether you're developing a personal project or a commercial application, paying attention to small details like removing the debug banner can make a big difference in the overall user experience. By following the steps outlined in this article, you can easily remove the debug banner and create a more polished and professional Flutter application. Happy coding!