Dart’s single-threaded model doesn’t mean you need to run everything as a
blocking operation that causes the UI to freeze. Unlike Android, which
requires you to keep the main thread free at all times, in Flutter,
use the asynchronous facilities that the Dart language provides, such as
async/await, to perform asynchronous work. You might be familiar with
the async/await paradigm if you’ve used it in C#, Javascript, or if you
have used Kotlin’s coroutines.

For example, you can run network code without causing the UI to hang by
using async/await and letting Dart do the heavy lifting:

Once the awaited network call is done, update the UI by calling setState(),
which triggers a rebuild of the widget sub-tree and updates the data.

The following example loads data asynchronously and displays it in a ListView:

Refer to the next section for more information on doing work in the
background, and how Flutter differs from Android.