How to remove the Flutter debug banner?

When you are running the flutter app for testing your app then you get the debug banner on the top right side. To remove it you have to set debugShowCheckedModeBanner: false. The banner will be automatically removed for the release build.

For MaterialApp set debugShowCheckedModeBanner to false.

MaterialApp(
  debugShowCheckedModeBanner: false,
)

For CupertinoApp set debugShowCheckedModeBanner to false.

  CupertinoApp(
     debugShowCheckedModeBanner: false
    )

Before adding debugShowCheckedModeBanner: false.

App showing debug banner
App showing debug banner

Full Code 

import 'package:flutter/material.dart';

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Application name
      title: 'My Flutter App',
      debugShowCheckedModeBanner: false, // Remove debug banner
      home: Scaffold(
        appBar: AppBar(
          // The title text which will be shown on the action bar
          title: Text("My Flutter App"),
        ),
        body: Center(
          child: Text("Code the Best"),
        ),
      ),
    );
  }
}

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

Output

App Not showing debug banner
App Not showing debug banner
Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.

SPECIAL OFFER!

This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In:
close-link