So I was trying this code in flutter:
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyA
There is something called Event Loop
Event Loop process Events in order
0.onPressed: () {
1.setState(() {
3. i++
4. Mark as widget dirty
5. Add to the global dirty widgets list
});
6.i++
});
7. check dirty widgets list
8. repaint
Here a YouTube video from Flutter in Focus series
Isolates and Event Loops
Or read it here
setState method - State class - widgets library - Dart API
markNeedsBuild method - Element class - widgets library - Dart API
scheduleBuildFor method - BuildOwner class - widgets library - Dart API
drawFrame method - WidgetsBinding class - widgets library - Dart API
handleDrawFrame method - SchedulerBinding class - scheduler library - Dart API
buildScope method - BuildOwner class - widgets library - Dart API
dart engine loop - Google Search
Dart Programming - Loops - Tutorialspoint
optimization - What is the optimal render loop in Dart 2? - Stack Overflow
Understanding Flutter Render Engine - Stack Overflow
Technical overview - Flutter
Flutter - Dart API docs
flutter/spinning_square.dart at master · flutter/flutter
14 .dart engine - Google Search
scheduler library - Dart API
flutter/binding.dart at master · flutter/flutter
scheduler library - Dart API
frame scheduling flutter - Google Search
scheduleFrame method - SchedulerBinding class - scheduler library - Dart API
scheduler library - Dart API
packages/flutter/lib/scheduler.dart - external/github.com/flutter/flutter - Git at Google
flutter/spinning_square.dart at master · flutter/flutter
dart engine - Google Search
threading | Dart Package
isolate flutter - Google Search