It is possible to make unit tests which call to a live server or a database but, doing so would either consume too much time or give unexpected results

Instead of relying on that, the Flutter team has provided us with a fantastic package for mocking dependencies, called Mockito.

What Mockito does is that, it emulates a dummy database and gives us returns based on our results.

So imagine you have a simple function that uses the HTTP package and then fetches results from the database and based on the result aka status code returns either exception or the JSON we required

#flutter #mockito #continous-deployment #testing #dart

Unit Testing In Flutter With Mockito
17.25 GEEK