logger_flutter_fork 1.3.1 copy "logger_flutter_fork: ^1.3.1" to clipboard
logger_flutter_fork: ^1.3.1 copied to clipboard

Flutter extension for logger. Please go there for documentation.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:logger_fork/logger_fork.dart';
import 'package:logger_flutter_fork/logger_flutter_fork.dart';

void main() {
  LogConsole.init();
  log();
  runApp(const MyApp());
}

var logger = Logger(
  printer: PrettyPrinter(),
);

var loggerNoStack = Logger(
  printer: PrettyPrinter(methodCount: 0),
);

void log() {
  logger.d("Log message with 2 methods");

  loggerNoStack.i("Info message");

  loggerNoStack.w("Just a warning!");

  logger.e("Error! Something bad happened", "Test Error");

  loggerNoStack.v({"key": 5, "value": "something"});
  loggerNoStack.wtf('What a terrible failure!');

  Future.delayed(const Duration(seconds: 5), log);
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            LogConsoleOnShake(
              child: const Text(
                'Shake device to open the log console',
              ),
            ),
            const Text(
              'or tap on floating action button to see log console',
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => LogConsole.open(context),
        tooltip: 'info',
        child: const Icon(Icons.info),
      ),
    );
  }
}
0
likes
130
points
56
downloads

Publisher

verified publishermoti.monster

Weekly Downloads

Flutter extension for logger. Please go there for documentation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, logger_fork, sensors_plus

More

Packages that depend on logger_flutter_fork