Skip to main content

Flutter Example of debugLabel on Text

debugLabel is basically used in Debug app builds. When we create Debug build for apps then we can run those builds into Debug mode directly and when the Text widget is render on screen then it will console the label. Though user knows this text has been rendered on the screen. This is very helpful then we have a large numbers of Text defined in our app and one of them has a issue in rendering.

Flutter Example of debugLabel on Text:

import 'package:flutter/material.dart';

void main() => runApp(const App());

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

  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
          body: Center(
              child: Text(
        'What is debugLabel?',
            TextStyle(fontSize: 34, debugLabel: 'This is debug Label of Text'),
Screenshot of App:
Flutter Example of debugLabel on Text