Open a14n opened 1 month ago
With the following code:
extension type MapType._(JSObject _) implements JSObject { @JS('f') external void _f(); void Function() get f => () => _f(); }
a lint unnecessary_lambdas appears on f getter.
unnecessary_lambdas
f
But if I use a tear-off:
extension type MapType._(JSObject _) implements JSObject { @JS('f') external void _f(); void Function() get f => _f; }
then I get an error:
Error: Tear-offs of external extension type interop member '_f' are disallowed.
So unnecessary_lambdas should not trigger on extension type external methods
(Dart 3.4.4)
Or maybe interop should support tear-of by generating a () => this._f() Dart function that you can tear of instead of the native function, if native functions can't be torn off directly.
() => this._f()
With the following code:
a lint
unnecessary_lambdas
appears onf
getter.But if I use a tear-off:
then I get an error:
So
unnecessary_lambdas
should not trigger on extension type external methods(Dart 3.4.4)