How to capture argument in Mockito Dart version

Viewed 700

I am trying to catch argument passes to a function and then make some assertions if one of the argument's property is equal to specific value.

Unfortunately an object is passed, therefore I can not just make a quick assertion according to official docs.

cat.eatFood("Fish");
expect(verify(cat.eatFood(captureAny)).captured.single, ["Fish"]);

I want to achieve something as shown if this pseudocode;

cat.eatFood(fridge);
expect(verify(cat.eatFood(captureAny)).captured.single, fridge.milk == "Milk");

or I just wont to store the argument fridge elsewhere.

1 Answers
Related