This chapter covers
- Writing Dart unit tests
- Mocking HTTP calls
- Writing Flutter widget tests
- Writing Flutter integration tests with Flutter drive
- Accessibility widgets in Flutter
In the roughly 100 interviews I’ve endured in my life, one of the most common questions the interviewer asks is, “What kind of testing do you do at your current job?” Trying to mask my inadequacy with humor, and hoping that the interviewer will just forget they care about testing code and move on, I always say, “Not as much as we should.” Which can be translated to “Not at all!” The only feeling of comfort I get from that is knowing that I’m not alone. (And, for the record, it’s never worked.)
The reason they ask about that, I think, is because it’s important, but often an afterthought. And that’s what this final chapter is about: subjects that are important, but often forgotten. First, I want to talk about testing Flutter apps. Towards the end, I’ll cover some built-in accessibility features in Flutter. You can think of this chapter as “things you should absolutely do for a production app, but probably aren’t needed for projects that’ll never leave your machine.”
Testing in Flutter can be split into three categories: