SlackErrorExporter constructor
SlackErrorExporter(})
Creates a SlackErrorExporter that posts to the given webhookUrl.
payloadBuilder — optional callback invoked on every send whose return
value is merged into the Slack Block Kit payload.
headersBuilder — optional callback invoked on every send whose return
value is merged into the HTTP request headers.
Implementation
SlackErrorExporter(
String webhookUrl, {
Map<String, dynamic> Function()? payloadBuilder,
Map<String, String> Function()? headersBuilder,
}) : super(
// Replace the template placeholder with the demo URL so users can
// run the example code without a real Slack webhook.
webhookUrl == _slackPlaceholderUrl
? HttpErrorExporter.demoUrl
: webhookUrl,
SlackPayloadFormatter(),
payloadBuilder: payloadBuilder != null
? (payload) => {...payload, ...payloadBuilder()}
: null,
headersBuilder: headersBuilder,
);