WebhookBackend constructor

WebhookBackend({
  1. required String url,
  2. Map<String, String> headers = const {},
  3. Map<String, dynamic> payloadBuilder(
    1. FeedbackEntry
    )?,
  4. Duration timeout = const Duration(seconds: 15),
  5. Client? httpClient,
})

Creates a WebhookBackend.

The url must use the https scheme. Passing an http URL throws an ArgumentError immediately to prevent accidental plaintext leaks.

Implementation

WebhookBackend({
  required this.url,
  this.headers = const {},
  this.payloadBuilder,
  this.timeout = const Duration(seconds: 15),
  http.Client? httpClient,
}) : _client = httpClient ?? http.Client() {
  if (Uri.parse(url).scheme != 'https') {
    throw ArgumentError.value(
        url, 'url', 'WebhookBackend requires an HTTPS URL');
  }
}