In the same way we're wrapping returned Promises in promiseToFuture, so they can be directly used in Dart as Futures, I think we could also wrap callbacks passed as parameters with allowInterop so the users' code in Dart doesn't need to.
I understand the generator itself can't know if there's going to be a negative performance impact from calling allowInterop automatically, but it'd be cool if there was a flag to control this behavior on a per-usage basis.
In the same way we're wrapping returned Promises in
promiseToFuture
, so they can be directly used in Dart as Futures, I think we could also wrap callbacks passed as parameters withallowInterop
so the users' code in Dart doesn't need to.On something like:
This generates:
Which in Dart you need to use as:
It'd be way more pleasing (and easier to read) to be able to just do:
I understand the generator itself can't know if there's going to be a negative performance impact from calling
allowInterop
automatically, but it'd be cool if there was a flag to control this behavior on a per-usage basis.