Dart How to mock a procedure
How do I go about mocking a procedure (as apposed to a function see here ) For example, given the following typedef and procedure, typedef int Adder(int a, int b); int useAdder(Adder adder) { return adder(1, 2); } How could you write a mock that would allow you to test that the userAdder procedure called you mocked function? This was my attempt, but it fails with the message that test failed: Caught The null object does not have a method 'call'. class MyMock extends Mock { MyMock(){ when(callsTo('call')).alwaysCall(this.foo); } int foo(int a, int b) => a+b; } void main() { test("bb", () { var