Index: packages/barback/lib/src/asset/asset_node.dart |
diff --git a/packages/barback/lib/src/asset/asset_node.dart b/packages/barback/lib/src/asset/asset_node.dart |
index 45d1b1771c215f165a2e3c001afb4a7ee5715e00..a9e000092d74681e52840bee14660d01ff130ac7 100644 |
--- a/packages/barback/lib/src/asset/asset_node.dart |
+++ b/packages/barback/lib/src/asset/asset_node.dart |
@@ -8,7 +8,6 @@ import 'dart:async'; |
import '../errors.dart'; |
import '../graph/transform_node.dart'; |
-import '../utils.dart'; |
import 'asset.dart'; |
import 'asset_id.dart'; |
@@ -84,7 +83,7 @@ class AssetNode { |
/// The return value of [callback] is piped to the returned Future. If the |
/// asset is removed before becoming available, the returned future will throw |
/// an [AssetNotFoundException]. |
- Future whenAvailable(callback(Asset asset)) { |
+ Future/*<T>*/ whenAvailable/*<T>*/(/*=T*/ callback(Asset asset)) { |
return _waitForState((state) => state.isAvailable || state.isRemoved, |
(state) { |
if (state.isRemoved) throw new AssetNotFoundException(id); |
@@ -115,9 +114,9 @@ class AssetNode { |
/// [callback] is called synchronously if this is already in such a state. |
/// |
/// The return value of [callback] is piped to the returned Future. |
- Future _waitForState(bool test(AssetState state), |
- callback(AssetState state)) { |
- if (test(state)) return syncFuture(() => callback(state)); |
+ Future/*<T>*/ _waitForState/*<T>*/(bool test(AssetState state), |
+ /*=T*/ callback(AssetState state)) { |
+ if (test(state)) return new Future.sync(() => callback(state)); |
return onStateChange.firstWhere(test).then((_) => callback(state)); |
} |