Closed srawlins closed 2 years ago
Having the same issue. @srawlins Is there any workaround?
Not that I know of.
@srawlins What is possible is to add 'required' into the refer():
FunctionType((b) {
b
..returnType = refer('int')
..requiredParameters.add(refer('String'))
..namedParameters['p1'] = refer('required double');
});
Ah that's a nice hack. That could definitely break at some point, but I like it for now.
I can create a FunctionType with a named parameter like so:
But there is no way to make that named parameter required; no way to generate
int Function(String, {required double p1})
. I imagine this would require a breaking change. 😦This is required for mockito. If a user has a class:
then it is impossible to generate a subclass of C with a legal overriding
f
.