Firehose constructor
Firehose({
- required FirehoseConnector connect,
- CursorStore? cursorStore,
- Duration initialBackoff = const Duration(seconds: 1),
- Duration maxBackoff = const Duration(minutes: 1),
- Duration healthyConnectionThreshold = const Duration(seconds: 30),
- double jitter = 0.2,
- int flushEveryEvents = defaultFlushEveryEvents,
- Duration flushEveryInterval = defaultFlushEveryInterval,
- void onError(
- Object error,
- StackTrace stackTrace
- 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',
);
}
}