How should our app handle a situation where it needs a service that can take some time to return its result, for example, when we have to fetch or store data, read a large file, or need a response from a web service. Obviously, the app can't wait for this to end and the result to arrive (the so-called synchronous way), because this would freeze the screen (and the app) and frustrate users. A responsive web app must be able to call this service and immediately continue with what it was doing. Only when the result returns should it react and call some function on the response data. This is called working in an asynchronous, non-blocking way. Most of the methods in dart:io
for server-side Dart apps work in this way.
Developers with a Java or C# background would perhaps think of starting another thread to do additional work, but Dart can't do it. Dart has to compile to JavaScript, so similar to JavaScript, it also works in a single-threaded model that is...