Skip to content

Instantly share code, notes, and snippets.

@Sfshaza
Last active September 9, 2015 17:06
Show Gist options
  • Save Sfshaza/6df1121fd6ea7b9e5201 to your computer and use it in GitHub Desktop.
Save Sfshaza/6df1121fd6ea7b9e5201 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