I am trying to mock the .find function in mongo_dart and it is asking for a return function that I just can't work out. It has a type, then another type, then the name. What / how do I express this return type.
This is legitimate code apparently:
Stream<Map<String, dynamic>> Function([selector]) _test(Invocation realInvocation) {
}
class selector {
}
Returning a Stream<Map<String, dynamic>>
throws an error - it says it needs a Stream<Map<String, dynamic>> Function([selector])
Help! I have never seen anything like it and Google isn't much help.
Edit, thanks to Irn's comment below, the solution ultimately was this code. See their answer and the comment I made for clarification
Stream<Map<String, dynamic>> Function([dynamic]) _test(Invocation realInvocation) {
return ([selector]) {
return Stream.value({"response":true});
};
}
selector
argument and returns aStream<Map<String, dynamic>>
.