Skip to content

Instantly share code, notes, and snippets.

@Sfshaza
Last active August 29, 2015 14:27
Show Gist options
  • Save Sfshaza/d3d5fb115c8d33e61c94 to your computer and use it in GitHub Desktop.
Save Sfshaza/d3d5fb115c8d33e61c94 to your computer and use it in GitHub Desktop.
futures/sequential-processing
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// 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.
import 'dart:async';
void main() {
expensiveA()
.then((aValue) => expensiveB())
.then((bValue) => expensiveC())
.then((cValue) => doSomethingWith(cValue));
}
Future expensiveA() => new Future.value('from expensiveA');
Future expensiveB() => new Future.value('from expensiveB');
Future expensiveC() => new Future.value('from expensiveC');
doSomethingWith(value) {
print(value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment