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

outdated

Plugin for error catching. Allows handling errors when they're not catched by developer. Plugin provides multiple handlers for errors.

example/lib/main.dart

import 'package:catcher/handlers/console_handler.dart';
import 'package:flutter/material.dart';

import 'package:catcher/catcher.dart';
void main() => Catcher(application: MyApp(), handlers: [ConsoleHandler()]);
class MyApp extends StatefulWidget{

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

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


  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(child:
          FlatButton(child: Text("Generate error"),onPressed: () => generateError())
        ),
      ),
    );
  }

  generateError()  async {

    try {
      foo() async {
        throw new StateError('This is an async Dart exception.');
      }
      bar() async {
        await foo();
      }
      await bar();
    } catch (exc,stackTrace){
      print("Cathced exc: "+ exc.toString());
      Catcher.getInstance().reportCheckedError(exc, stackTrace);
    }
  }

}
577
likes
0
pub points
95%
popularity

Publisher

unverified uploader

Plugin for error catching. Allows handling errors when they're not catched by developer. Plugin provides multiple handlers for errors.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

device_info, dio, flutter, flutter_local_notifications, fluttertoast, mailer, package_info

More

Packages that depend on catcher