DevTools
- Flutter course
- Expert
- Lesson 7/39
- 4 min
Profile CPU and widgets with Flutter DevTools.
DevTools
DevTools is the official debugging and profiling tool for Flutter and Dart. The timeline tab shows frame timings, the cpu tab shows CPU usage. It is launched with flutter devtools.
// Terminal
flutter devtoolsCPU tab
The cpu tab breaks down CPU time by function; it shows which method consumes the most time. timeline flags slow frames, cpu helps find the source of the slowness.
Practice Frame rate check
In main, assign 16 (ms) to a const variable named frame. If frame > 16, print 'yavas', otherwise print 'hizli'.
Starter code
void main() {
// frame değişkeni 16 ms olsun
// 16'dan büyükse 'yavas', değilse 'hizli' yazdır
}Sample solution
void main() {
const frame = 16;
if (frame > 16) {
print('yavas');
} else {
print('hizli');
}
}Expected output
hizli
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which tab in DevTools shows frame timings?
- memory
- cpu
- network
- timeline Correct answer
Explanation: The timeline tab in DevTools shows the draw time of each frame; the cpu tab shows CPU usage, the memory tab shows memory.
2 DevTools command
flutter ____
flutter devtools
Explanation: DevTools is launched with 'flutter devtools'; debug, profile and analyze are subcommands for different purposes.
3 DevTools matches
| Term | Meaning |
|---|---|
DevTools |
Profiling tool |
timeline |
Frame timings |
cpu |
CPU usage |
flutter devtools |
DevTools launch |