Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: packages/watcher/lib/src/utils.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/watcher/lib/src/stat.dart ('k') | packages/watcher/lib/src/watch_event.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/watcher/lib/src/utils.dart
diff --git a/packages/watcher/lib/src/utils.dart b/packages/watcher/lib/src/utils.dart
index 007c84c193f1bea55261659fd91058bf9a9678be..6f3ff021577e94b9df3725bb79a69b23f134477d 100644
--- a/packages/watcher/lib/src/utils.dart
+++ b/packages/watcher/lib/src/utils.dart
@@ -2,12 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library watcher.utils;
-
import 'dart:async';
import 'dart:io';
import 'dart:collection';
+import 'package:async/async.dart';
+
/// Returns `true` if [error] is a [FileSystemException] for a missing
/// directory.
bool isDirectoryNotFoundException(error) {
@@ -31,17 +31,18 @@ Set unionAll(Iterable<Set> sets) =>
/// If [broadcast] is true, a broadcast stream is returned. This assumes that
/// the stream returned by [future] will be a broadcast stream as well.
/// [broadcast] defaults to false.
-Stream futureStream(Future<Stream> future, {bool broadcast: false}) {
+Stream/*<T>*/ futureStream/*<T>*/(Future<Stream/*<T>*/> future,
+ {bool broadcast: false}) {
var subscription;
- var controller;
+ StreamController/*<T>*/ controller;
- future = future.catchError((e, stackTrace) {
+ future = DelegatingFuture.typed(future.catchError((e, stackTrace) {
// Since [controller] is synchronous, it's likely that emitting an error
// will cause it to be cancelled before we call close.
if (controller != null) controller.addError(e, stackTrace);
if (controller != null) controller.close();
controller = null;
- });
+ }));
onListen() {
future.then((stream) {
@@ -94,7 +95,7 @@ Future pumpEventQueue([int times = 20]) {
/// microtasks.
class BatchedStreamTransformer<T> implements StreamTransformer<T, List<T>> {
Stream<List<T>> bind(Stream<T> input) {
- var batch = new Queue();
+ var batch = new Queue<T>();
return new StreamTransformer<T, List<T>>.fromHandlers(
handleData: (event, sink) {
batch.add(event);
« no previous file with comments | « packages/watcher/lib/src/stat.dart ('k') | packages/watcher/lib/src/watch_event.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698