LCOV - code coverage report
Current view: top level - async-2.5.0/lib/src/result - value.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 3 15 20.0 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2016, 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             : import 'result.dart';
       8             : import 'error.dart';
       9             : 
      10             : /// A result representing a returned value.
      11             : class ValueResult<T> implements Result<T> {
      12             :   /// The result of a successful computation.
      13             :   final T value;
      14             : 
      15           0 :   @override
      16             :   bool get isValue => true;
      17           0 :   @override
      18             :   bool get isError => false;
      19           0 :   @override
      20             :   ValueResult<T> get asValue => this;
      21           0 :   @override
      22             :   ErrorResult? get asError => null;
      23             : 
      24          11 :   ValueResult(this.value);
      25             : 
      26          11 :   @override
      27             :   void complete(Completer<T> completer) {
      28          22 :     completer.complete(value);
      29             :   }
      30             : 
      31           0 :   @override
      32             :   void addTo(EventSink<T> sink) {
      33           0 :     sink.add(value);
      34             :   }
      35             : 
      36           0 :   @override
      37           0 :   Future<T> get asFuture => Future.value(value);
      38             : 
      39           0 :   @override
      40           0 :   int get hashCode => value.hashCode ^ 0x323f1d61;
      41             : 
      42           0 :   @override
      43             :   bool operator ==(Object other) =>
      44           0 :       other is ValueResult && value == other.value;
      45             : }

Generated by: LCOV version 1.14