Profile mode
- Flutter course
- Expert
- Lesson 6/39
- 4 min
Measure real performance with profile mode.
Profile mode
profile mode runs the Flutter app close to real device performance. There is no debug overhead, but DevTools still collects trace and build metrics. It is launched with flutter run --profile.
// Terminal
flutter run --profiletrace and build metrics
In profile mode, DevTools records build time, trace events and frame timings. You can see how long each frame takes to draw. Slow frames are marked yellow, very slow ones red.
Practice List the profile command
In main, define a List<String> named cmd with the values 'flutter', 'run', '--profile' in order. Print the last element with print.
Starter code
void main() {
// flutter run --profile komutunu bir liste olarak tanımla
// listenin son elemanını yazdır
}Sample solution
void main() {
final cmd = ['flutter', 'run', '--profile'];
print(cmd.last);
}Expected output
--profile
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command launches profile mode?
- flutter test
- flutter run --profile Correct answer
- flutter run
- flutter build
Explanation: Profile mode is launched with 'flutter run --profile'; plain 'flutter run' opens in debug mode.
2 Profile command
flutter run ____
flutter run --profile
Explanation: Profile mode is launched with 'flutter run --profile'; --debug adds overhead, --release disables metrics, --test runs tests.
3 Profile mode matches
| Term | Meaning |
|---|---|
profile |
Real performance mode |
build |
Widget creation process |
trace |
Event recording |
frame |
One drawing unit |