In this tutorial we will learn to remove debug text banner in flutter application. When we first time setup the project and install it in device it shows debug
text banner at right top side of application so if we want to remove it we simply need to add debugShowCheckedModeBanner
to Material app or Cupertino
app.
To hide or remove the debug banner add debugShowCheckedModeBanner
with value false
to Material App or Cupertino
app. You can simple add it as follow
MaterialApp(
debugShowCheckedModeBanner: false
)
CupertinoApp(
debugShowCheckedModeBanner: false
)
Note: You only need to add it in root main material app not in all widget.
Let’s understand Remove Debug Text Banner in Flutter Application with an example
Step 1 : Create flutter project
Very first step is to create the fluter application using command line tool or in Android studio.
flutter create example_app
This will create a new project with name my_app then go in to the folder .
Step 2 : Update main.dart file
Now, open the main.dart file and add the debugShowCheckedModeBanner
with value false
to Material App
File : lib/main.dart
import 'package:example_app/assetimagedemo.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false, // <-- add this
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Container(child:Text("Test")),
);
}
}
Step 3: Run the project
Simply run the project using command line or in android studio to check the implementation.
flutter run lib/main.dart
Screenshot :
Read Also : How to create routing in flutter and pass parameters to routes ?