'Flutter, test failing when running together but passing when running indivudally

I've been working on flutter unit testing on my API but I encountered a problem.

I've mocked an HTTP client to test all the POST, GET, DELETE, and PATCH requests. The problem is that when I run all my tests together, some tests on POST and PATCH requests fail (often after a test on a POST or PATCH request that passes) but when I run them individually, they pass.

The error I face is: Bad state: Cannot call when within a stub response

If anyone has encountered a similar problem and found a solution I would gladly take it :)

Thanks in advance for your time on my problem, I wish you all a good day!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source