Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Call-stack architectures versus event-driven architectures


For a better understanding of asynchronous programming in Dart, we will discuss call-stack and event-driven architectures.

Call-stack architectures

Traditionally, programs are built on the concept of a call stack. This concept is pretty straightforward because a program is basically a path of execution and invocation of sequential operations. Every operation can invoke another operation. At the time of invocation, a program creates a context for the callee operation. The caller operation will wait for the callee operation to return and the program will restore the context of it. Finally, the caller continues with their next operation. The callee operation might have executed another operation on its own behalf.

The program creates a call stack to coordinate and manage the context of each call. The basic primitives of this concept are calls. All calls in the program are tightly coupled, because the program knows which operation must...