err 0.7.3 copy "err: ^0.7.3" to clipboard
err: ^0.7.3 copied to clipboard

outdated

A logs router that can pop messages to the device screen. The routes are configurable for each log level.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'logger.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Err example',
      home: MyHomePage(),
    );
  }
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    logger.debugFlash("Init state");
    super.initState();
  }

  bool _firstBuildDone = false;

  @override
  Widget build(BuildContext context) {
    if (!_firstBuildDone)
      logger.debugFlash("First build").then((_) {
        _firstBuildDone = true;
      });
    return Scaffold(
        body: Padding(
            padding: const EdgeInsets.all(25.0),
            child: ListView(
              children: <Widget>[
                RaisedButton(
                  child: const Text("Info flash message"),
                  onPressed: () => logger.infoFlash("An info flash message"),
                ),
                RaisedButton(
                    child: const Text("Info regular message"),
                    onPressed: () =>
                        logger.infoScreen("An info message", context: context)),
                RaisedButton(
                    child: const Text("Warning message"),
                    onPressed: () => logger.warningScreen(
                        "Hey, this is warning!",
                        context: context)),
                RaisedButton(
                    child: const Text("Error message"),
                    onPressed: () => logger.errorScreen("Something went wrong",
                        context: context)),
                RaisedButton(
                    child: const Text("Critical message from exception"),
                    onPressed: () {
                      try {
                        _doWrong();
                      } catch (e) {
                        logger.criticalScreen("Something went really wrong",
                            err: e, context: context);
                      }
                    }),
                RaisedButton(
                    child: const Text("Debug message"),
                    onPressed: () => logger.debugScreen("Debug info message",
                        context: context)),
              ],
            )));
  }

  void _doWrong() {
    List<String> li;
    li.add("wrong");
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}
0
likes
0
pub points
47%
popularity

Publisher

unverified uploader

A logs router that can pop messages to the device screen. The routes are configurable for each log level.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flushbar, flutter, fluttertoast

More

Packages that depend on err