Flutter testing for exceptions in widget tests

Posted by Jennifer | Updated on

Flutter testing for exceptions in widget tests. To catch exceptions thrown in a flutter test, use WidgetTester.takeException. This returns the last exception caught by the framework.

You also don’t need a throwsA matcher, since it is not being thrown from the method.


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.

Related Questions & Answers