exampleUsage function
void
exampleUsage()
Example: Custom error reporter for a different service This shows the pattern for implementing any error reporting service Example: Using the error reporter in your app
Implementation
/*
class CustomErrorReporter implements ErrorReporter {
final String apiKey;
CustomErrorReporter({required this.apiKey});
@override
Future<void> initialize() async {
// Initialize your error reporting service
// await YourService.init(apiKey: apiKey);
}
@override
void recordError(Object error, StackTrace? stackTrace) {
// Send error to your service
// YourService.reportError(error, stackTrace);
}
@override
void recordFlutterError(FlutterErrorDetails details) {
// Send Flutter error to your service
// YourService.reportFlutterError(details);
}
}
*/
/// Example: Using the error reporter in your app
void exampleUsage() {
// Errors are automatically caught and reported
// Manual error logging (automatically reports to configured service)
try {
// Your code that might throw
throw Exception('Something went wrong');
} catch (error, stackTrace) {
// This will report to all configured error reporters
// loge(error, 'Error in exampleUsage', stackTrace);
}
}