LCOV - code coverage report

Current view
top level - src/_impl/web - _event_buffer.dart
Test
lcov.info
Date
2024-11-13
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines151788.2%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'dart:async';
2
3class EventBuffer<T> {
49 EventBuffer(this._processValue, this._processError);
5
60 FutureOr<void> Function()? onDeactivate;
7
8 final void Function(T) _processValue;
9 final void Function(Object, StackTrace?) _processError;
10
119 final _buffer = <void Function()>[];
12
13 var _pauses = 0;
14
1510 bool get isActive => _pauses > 0;
16
172 void activate() => _pauses++;
18
192 void deactivate() {
202 if (_pauses == 1) {
212 for (var fn in _buffer) {
222 fn.call();
23 }
242 _buffer.clear();
252 onDeactivate?.call();
26 }
272 if (_pauses > 0) {
282 _pauses--;
29 }
302 }
31
329 void add(T value) => _buffer.add(() => _processValue(value));
33
340 void addError(Object err, StackTrace? st) =>
359 _buffer.add(() => _processError(err, st));
36}
Choose Features