I have coded in dart and flutter for the past 3 months. I have one app in the play store. But I still don't understand how threading system of flutter works.
To make things simple let's take the most basic counter app that you get when you do flutter create basicapp
.
Question no 1. How many threads are there in that basic app?
Question no 2. If there are multiple threads when are they created? When it calls runApp(MyApp())
?
Question no 3. I know that dart has a concept of isolates. Are isolates the same as threads?
CodePudding user response:
Question 1:
When the application starts running, there is a single Isolate/Thread that we know as the UI thread.
Question 2:
Generally you are good with a single thread in most applications. But in case you want to create a separate Isolate, you can use "Isolate.spawn". Provided a link in the end for better understanding.
Question 3:
Answering simply, Yes.
Here is a link for better understanding.
Cheers!! Hope it helps.