flutter_debug_tools 0.0.2 copy "flutter_debug_tools: ^0.0.2" to clipboard
flutter_debug_tools: ^0.0.2 copied to clipboard

A set of tools to help find and debug UI or performance issues from the Flutter app itself.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_debug_tools/flutter_debug_tools.dart';
import 'package:loggy/loggy.dart';

void main() {
  // Add `DebugLoggyPrinter` to enable the debug logs
  Loggy.initLoggy(logPrinter: DebugLoggyPrinter());
  // Log messages
  logDebug('This is debug message');
  logInfo('This is info message');
  logWarning('This is warning message');
  logError('This is error message');
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    // Add `FlutterDebugTools` above your `MaterialApp` to enable the debug tools
    return FlutterDebugTools(builder: (context, shouldShowPerfOverlay, child) {
      return MaterialApp(
        showPerformanceOverlay: shouldShowPerfOverlay,
        title: 'Flutter Demo',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        home: const MyHomePage(title: 'Flutter Demo Home Page'),
      );
    });
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
3
likes
0
points
29
downloads

Publisher

verified publisherhashstudios.dev

Weekly Downloads

A set of tools to help find and debug UI or performance issues from the Flutter app itself.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

device_info_plus, flutter, loggy, shared_preferences

More

Packages that depend on flutter_debug_tools