djangoflow_error_reporter 0.1.0+3 copy "djangoflow_error_reporter: ^0.1.0+3" to clipboard
djangoflow_error_reporter: ^0.1.0+3 copied to clipboard

Djangoflow Error Reporter is a library that provides an easy and flexible way to handle errors in your flutter application.

djangoflow_error_reporter #

Djangoflow Error Reporter is a library that provides an easy and flexible way to handle errors in your flutter application. It allows you to add multiple error reporters and provides a singleton for managing them all. It also provides basic functionality for initializing, reporting and updating user information.

Installation #

Add the package to your pubspec.yaml file:

dependencies:
  djangoflow_error_reporter: <latest_version>

Then run flutter pub get to install the package.

Usage #

Enabling error reporting #

To enable the error reporter, you can use the enableErrorReporting method of DjangoflowErrorReporter.instance. Disabled by default.

DjangoflowErrorReporter.instance.enableErrorReporting();

Initializing #

To initialize the error reporter, you can use the initialize method of the DjangoflowErrorReporter class. This method takes in two optional strings, env and release. This will initialize/re-initialize with new env and release values.

DjangoflowErrorReporter.instance.initialize(env: 'production', release: '1.0.0+1');

Reporting errors #

To report an error, you can use the report method of the DjangoflowErrorReporter class. This method takes in an exception object and an optional stackTrace object.

try {
  // some code that throws an exception
} catch (e, s) {
  DjangoflowErrorReporter.instance.report(exception: e, stackTrace: s);
}

Updating user information #

To update the user information, you can use the updateUserInformation method of the DjangoflowErrorReporter class. This method takes in three optional strings, id, email, and name.

DjangoflowErrorReporter.instance.updateUserInformation(id: '123', email: '[email protected]', name: 'John Doe');

Adding error reporters #

To add error reporters to the DjangoflowErrorReporter class, you can use the addAll method. This method takes in a list of ErrorReporter objects.

final errorReporter1 = CustomErrorReporter();
final errorReporter2 = AnotherCustomErrorReporter();
final errorReporters = [errorReporter1, errorReporter2];
DjangoflowErrorReporter.instance.addAll(errorReporters);

Example #

import 'package:djangoflow_error_reporter/djangoflow_error_reporter.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    DjangoflowErrorReporter.instance
        .initialize(env: 'production', release: '1.0.0+1');

    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: RaisedButton(
            onPressed: () {
              try {
                throw Exception('Something went wrong');
              } catch (e, s) {
                DjangoflowErrorReporter.instance.report(exception: e, stackTrace: s);
              }
            },
            child: Text('Throw Exception'),
          ),
        ),
      ),
    );
  }
}
0
likes
140
pub points
40%
popularity

Publisher

verified publisherapexive.com

Djangoflow Error Reporter is a library that provides an easy and flexible way to handle errors in your flutter application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on djangoflow_error_reporter