handle method

  1. @override
Future<bool> handle(
  1. Report report,
  2. BuildContext? context
)
override

Method called when report has been accepted by user

Implementation

@override
Future<bool> handle(Report report, BuildContext? context) async {
  try {
    _printLog('Logging to sentry...');

    final tags = <String, dynamic>{};
    if (enableApplicationParameters) {
      tags.addAll(report.applicationParameters);
    }
    if (enableDeviceParameters) {
      tags.addAll(report.deviceParameters);
    }
    if (enableCustomParameters) {
      tags.addAll(report.customParameters);
    }

    final event = buildEvent(report, tags);
    await sentryClient.captureEvent(event);

    _printLog('Logged to sentry!');
    return true;
  } catch (exception, stackTrace) {
    _printLog('Failed to send sentry event: $exception $stackTrace');
    return false;
  }
}