Hit | Total | Coverage | |
---|---|---|---|
Lines | 5 | 5 | 100.0% |
Functions | 0 | 0 | - |
Branches | 0 | 0 | - |
Line | Branch | Hits | Source code |
---|---|---|---|
1 | import 'dart:async'; |
||
2 |
|
||
3 | import '../../exceptions/squadron_exception.dart'; |
||
4 |
|
||
5 | class ForwardCompleter<T> { |
||
6 | final _res = Completer<T>(); |
||
7 |
|
||
8 | 32 | Future<T> get future => _res.future; |
|
9 |
|
||
10 | 8 | void success(T data) { |
|
11 | 40 | if (!_res.isCompleted) _res.complete(data); |
|
12 | } |
||
13 |
|
||
14 | 2 | void failure(SquadronException ex) { |
|
15 | 11 | if (!_res.isCompleted) _res.completeError(ex); |
|
16 | } |
||
17 | } |