How to access the contents of a StatefulWidget’s State during a unit test?
Answer: Create the widget using tester.pumpWidgets, then use tester.state(find.foo) to find the State (where find.foo is a finder that finds the widget). See the WidgetTester documentation for more options.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.