Flutter Chapter 13 of 16
Testing, Debugging and Quality
Test your widgets, find bugs with DevTools, keep the app fast, and make it usable in every language and by everyone.
Getting an app to work on your own phone is the start. This chapter is about making it work reliably for everyone else.
Lessons in this chapter
- Keys in Flutter: ValueKey, UniqueKey and GlobalKeyUnderstand what keys do in Flutter, when you need ValueKey, ObjectKey, UniqueKey or GlobalKey, and how they fix list state bugs.
- Unit and Widget Testing in FlutterWrite unit tests and widget tests in Flutter with flutter_test: pump widgets, find them, tap, enter text and verify the result.
- Integration Testing in FlutterTest complete user journeys in Flutter with the integration_test package: run the real app on a device, tap through screens and verify.
- Debugging Flutter Apps with DevToolsFind and fix bugs in Flutter: read error messages, use the widget inspector, breakpoints, logging and DevTools, and handle errors in release.
- Flutter Performance: Building Smooth, Fast AppsMake Flutter apps fast: const widgets, small rebuilds, lazy lists, image sizing, isolates, and finding slow frames with DevTools.
- Accessibility in FlutterMake Flutter apps usable by everyone: screen reader labels with Semantics, tap target sizes, contrast, text scaling and testing with TalkBack.
- Localization in Flutter: Supporting Multiple LanguagesTranslate a Flutter app with flutter_localizations and ARB files: setup, placeholders, plurals, dates, right-to-left and language switching.