LCOV - code coverage report
Current view: top level - async-1.13.3/lib/src/delegate - event_sink.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 0 6 0.0 %
Date: 2017-10-10 20:17:03 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
       2             : // for details. All rights reserved. Use of this source code is governed by a
       3             : // BSD-style license that can be found in the LICENSE file.
       4             : 
       5             : import 'dart:async';
       6             : 
       7             : /// Simple delegating wrapper around an [EventSink].
       8             : ///
       9             : /// Subclasses can override individual methods, or use this to expose only the
      10             : /// [EventSink] methods of a subclass.
      11             : class DelegatingEventSink<T> implements EventSink<T> {
      12             :   final EventSink _sink;
      13             : 
      14             :   /// Create a delegating sink forwarding calls to [sink].
      15           0 :   DelegatingEventSink(EventSink<T> sink) : _sink = sink;
      16             : 
      17           0 :   DelegatingEventSink._(this._sink);
      18             : 
      19             :   /// Creates a wrapper that coerces the type of [sink].
      20             :   ///
      21             :   /// Unlike [new DelegatingEventSink], this only requires its argument to be an
      22             :   /// instance of `EventSink`, not `EventSink<T>`. This means that calls to
      23             :   /// [add] may throw a [CastError] if the argument type doesn't match the
      24             :   /// reified type of [sink].
      25             :   static EventSink<T> typed<T>(EventSink sink) =>
      26           0 :       sink is EventSink<T> ? sink : new DelegatingEventSink._(sink);
      27             : 
      28             :   void add(T data) {
      29           0 :     _sink.add(data);
      30             :   }
      31             : 
      32             :   void addError(error, [StackTrace stackTrace]) {
      33           0 :     _sink.addError(error, stackTrace);
      34             :   }
      35             : 
      36             :   void close() {
      37           0 :     _sink.close();
      38             :   }
      39             : }

Generated by: LCOV version 1.13