LCOV - code coverage report
Current view: top level - lib/src/utils - cached_stream_controller.dart (source / functions) Hit Total Coverage
Test: merged.info Lines: 10 12 83.3 %
Date: 2024-09-27 11:38:01 Functions: 0 0 -

          Line data    Source code
       1             : import 'dart:async';
       2             : 
       3             : class CachedStreamController<T> {
       4             :   T? _value;
       5             :   Object? _lastError;
       6             :   final StreamController<T> _streamController = StreamController.broadcast();
       7             : 
       8          39 :   CachedStreamController([T? value]) : _value = value;
       9             : 
      10          64 :   T? get value => _value;
      11           0 :   Object? get lastError => _lastError;
      12          81 :   Stream<T> get stream => _streamController.stream;
      13             : 
      14          33 :   void add(T value) {
      15          33 :     _value = value;
      16          66 :     _streamController.add(value);
      17             :   }
      18             : 
      19           1 :   void addError(Object error, [StackTrace? stackTrace]) {
      20           2 :     _lastError = value;
      21           2 :     _streamController.addError(error, stackTrace);
      22             :   }
      23             : 
      24           3 :   Future close() => _streamController.close();
      25           0 :   bool get isClosed => _streamController.isClosed;
      26             : }

Generated by: LCOV version 1.14