Firehose constructor

Firehose({
  1. required FirehoseConnector connect,
  2. CursorStore? cursorStore,
  3. Duration initialBackoff = const Duration(seconds: 1),
  4. Duration maxBackoff = const Duration(minutes: 1),
  5. Duration healthyConnectionThreshold = const Duration(seconds: 30),
  6. double jitter = 0.2,
  7. int flushEveryEvents = defaultFlushEveryEvents,
  8. Duration flushEveryInterval = defaultFlushEveryInterval,
  9. void onError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
  10. Random? random,
})

Returns the new instance of Firehose.

Implementation

Firehose({
  required final FirehoseConnector connect,
  final CursorStore? cursorStore,
  this.initialBackoff = const Duration(seconds: 1),
  this.maxBackoff = const Duration(minutes: 1),
  this.healthyConnectionThreshold = const Duration(seconds: 30),
  this.jitter = 0.2,
  this.flushEveryEvents = defaultFlushEveryEvents,
  this.flushEveryInterval = defaultFlushEveryInterval,
  final void Function(Object error, StackTrace stackTrace)? onError,
  final Random? random,
}) : _connect = connect,
     _cursorStore = cursorStore ?? InMemoryCursorStore(),
     _onError = onError,
     _random = random ?? Random() {
  if (jitter < 0 || jitter > 1) {
    throw ArgumentError.value(jitter, 'jitter', 'must be within 0.0..1.0');
  }
  if (flushEveryEvents < 1) {
    throw ArgumentError.value(
      flushEveryEvents,
      'flushEveryEvents',
      'must be at least 1',
    );
  }
}