Asynchronous Programming

Concurrency in Dart.

Leveraging the main thread/isolate

For Apple operating systems, the primary (also called the main) 
thread is where the application begins running. 
Rendering the user interface always happens on the main thread. 
One difference between Swift and Dart is that
Swift might use different threads for different tasks, 
and Swift doesn’t guarantee which thread is used. 
So, when dispatching UI updates in Swift, 
you might need to ensure that the work occurs on the main thread.

Say you want to write a function that fetches the 
weather asynchronously and 
displays the results.

In GCD, to manually dispatch a process to the main thread, 
you might do something like the following.

First, define the Weather enum:

// 1 second delay is used in mocked API call.

extension

UInt64

static