E.6. What’s the equivalent of runOnUiThread() in Flutter?

The closest equivalent is Isolates in Dart. But they aren’t quite the same because Dart is single-threaded and event-loop driven. There is no UI thread, and there is no need to run UI in a different thread.

You can use Isolate objects to perform heavy computation that won’t block the event loop, but it isn’t necessary for the UI. At my day job, we have multiple web and mobile clients written in Dart, and I don’t think we use a single Isolate. Rather, you can use Dart’s asynchronous features to run code to perform async work.

Note

Chapter 9 is all about async Dart and Flutter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.42.164