djangoflow_error_reporter

Creator: coderz1093

Last updated:

0 purchases

djangoflow_error_reporter Image
djangoflow_error_reporter Images

Languages

Categories

Add to Cart

Description:

djangoflow error reporter

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>
copied to clipboard
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();
copied to clipboard
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');
copied to clipboard
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);
}
copied to clipboard
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');
copied to clipboard
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);
copied to clipboard
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'),
),
),
),
);
}
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.