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

Unified Diff: packages/async/lib/src/async_memoizer.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/async/lib/src/async_cache.dart ('k') | packages/async/lib/src/byte_collector.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/async/lib/src/async_memoizer.dart
diff --git a/packages/async/lib/src/async_memoizer.dart b/packages/async/lib/src/async_memoizer.dart
index 41c3dae87a46054708456ced01a04d582891cb07..d1c0f32908a330db40bb6227753cf0e10b583d25 100644
--- a/packages/async/lib/src/async_memoizer.dart
+++ b/packages/async/lib/src/async_memoizer.dart
@@ -2,8 +2,6 @@
// 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 async.async_memoizer;
-
import 'dart:async';
/// A class for running an asynchronous function exactly once and caching its
@@ -33,15 +31,15 @@ class AsyncMemoizer<T> {
///
/// This can be accessed at any time, and will fire once [runOnce] is called.
Future<T> get future => _completer.future;
- final _completer = new Completer();
+ final _completer = new Completer<T>();
- /// Whether [run] has been called yet.
+ /// Whether [runOnce] has been called yet.
bool get hasRun => _completer.isCompleted;
/// Runs the function, [computation], if it hasn't been run before.
///
- /// If [run] has already been called, this returns the original result.
- Future<T> runOnce(computation()) {
+ /// If [runOnce] has already been called, this returns the original result.
+ Future<T> runOnce(FutureOr<T> computation()) {
if (!hasRun) _completer.complete(new Future.sync(computation));
return future;
}
« no previous file with comments | « packages/async/lib/src/async_cache.dart ('k') | packages/async/lib/src/byte_collector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698