sendCustom static method

Future<void> sendCustom({
  1. required String className,
  2. required String reason,
  3. List<String>? tags,
  4. Map<String, dynamic>? customData,
  5. StackTrace? stackTrace,
})

Sends a custom error message to Raygun.

className and reason correspond to the class name and message displayed in Raygun's dashboard.

tags A list of data that will be attached to the Raygun message and visible on the error in the dashboard. This could be a build tag, lifecycle state, debug/production version etc.

customData A set of custom key-value pairs relating to your application and its current state. This is a bucket where you can attach any related data you want to see to the error.

stackTrace optional parameter, if not provided this method will obtain the current stacktrace automatically.

Implementation

static Future<void> sendCustom({
  required String className,
  required String reason,
  List<String>? tags,
  Map<String, dynamic>? customData,
  StackTrace? stackTrace,
}) async {
  Trace trace;
  if (stackTrace == null) {
    // if no stackTrace provided, create one
    trace = Trace.current();
  } else {
    trace = Trace.from(stackTrace);
  }

  return CrashReporting.send(className, reason, tags, customData, trace);
}