Skip to content

Instantly share code, notes, and snippets.

@SteveAlexander
Created January 15, 2021 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveAlexander/c4ea40f75c2b0742a00d9852597f8fdc to your computer and use it in GitHub Desktop.
Save SteveAlexander/c4ea40f75c2b0742a00d9852597f8fdc to your computer and use it in GitHub Desktop.
Levels of abstraction of computation in Dart — see http://worrydream.com/#!2/LadderOfAbstraction
String level0() {
return "asd";
}
Future<String> level1Async() async {
await Future.delayed(Duration(seconds: 1), () {});
return "asd";
}
Iterable<String> level1Iteration() sync* {
yield "a";
yield "s";
yield "d";
}
Stream<String> level2IterationAndAsync() async* {
yield "a";
await Future.delayed(Duration(seconds: 1), () {});
yield "s";
yield "d";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment