How to remove DEBUG banner (or label) in Flutter?

0

All you need is just a single line of code.

There may be an occasion you want to screenshot your app and show it to your client. Unfortunately, a DEBUG banner is marked on the top right corner in the debug (aka. development) build. It could look ugly when presenting your app project to the clients. How to get rid of this unwanted label?

In MaterialApp widget, set debugShowCheckedModeBanner to false.

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: const Center(
          child: Text('Hello World'),
        ),
      ),
    );
  }
}

Here is the result after the DEBUG banner being removed.

Even if you do not add this line of code, the DEBUG banner will still be removed in the release build.

Leave a Reply

Your email address will not be published. Required fields are marked *