flu_console 1.1.0 copy "flu_console: ^1.1.0" to clipboard
flu_console: ^1.1.0 copied to clipboard

It can print the logs generated by the flutter application to the mobile phone screen in real time, without the development tools, to better help analyze the logs.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flu_console/flu_console.dart';

void main() {
  FluConsole.run(() {
    runApp(const App());
  },enableLog: true);
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _MyAppState();
}

class _MyAppState extends State<HomePage> {
  int count = 0;

  Timer? timer;

  @override
  void initState() {
    super.initState();

    timer = Timer.periodic(const Duration(milliseconds: 500), (timer) {
      print("${(count++)}");
      if (count == 20) {
        timer.cancel();
        throw Exception('test error');
      }
    });
  }

  @override
  void dispose() {
    super.dispose();
    timer?.cancel();
    print("dispose");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Stack(
          children: [
            Center(
              child: GestureDetector(
                child: const Text(''),
              ),
            ),
            Column(
              children: [
                LayoutBuilder(builder: (ctx, constraints) {
                  return Row(
                    children: [
                      ElevatedButton(
                        onPressed: () {
                          FluConsole.showConsoleButton(context);
                          FluConsole.showConsoleButton(context);
                        },
                        child: const Text("show log button"),
                      ),
                      const SizedBox(width: 10),
                      ElevatedButton(
                        onPressed: () {
                          Navigator.of(ctx)
                              .push(PageNavAnimBuilder(const LogPrintPanel()));
                        },
                        child: const Text("open log"),
                      )
                    ],
                  );
                })
              ],
            )
          ],
        ),
      ),
    );
  }
}
2
likes
135
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

It can print the logs generated by the flutter application to the mobile phone screen in real time, without the development tools, to better help analyze the logs.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flu_console

Packages that implement flu_console