BeforeCaptureCallback typedef

BeforeCaptureCallback = FutureOr<bool> Function(SentryEvent event, Hint hint, bool debounce)

A callback which can be used to suppress capturing of screenshots. It's called in ScreenshotEventProcessor if screenshots are enabled. This gives more fine-grained control over when capturing should be performed, e.g., only capture screenshots for fatal events or override any debouncing for important events.

Since capturing can be resource-intensive, the debounce parameter should be respected if possible.

Example:

if (debounce) {
  return false;
} else {
  // check event and hint
}

event is the event to be checked. hint provides additional hints. debounce indicates if capturing is marked for being debounced.

Returns true if capturing should be performed, otherwise false.

Implementation

typedef BeforeCaptureCallback = FutureOr<bool> Function(
  SentryEvent event,
  Hint hint,
  bool debounce,
);