Closed
Description
On struct fields, we don't require annotating the native types if they are identical to the Dart type. This is true for Pointer
, and subtypes of Struct
and Union
. In the context of function types Void
is also non-ambigious.
As @mkustermann suggested in #54739 (comment), we should consider making the type argument for @Native
external functions omittable if it is pinned down by the Dart type:
@Native(isLeaf: true)
external void myFunc(Pointer<Int8>);
The only valid signature for this would be:
@Native<Void Function(Pointer<Int8>)>(isLeaf: true)
external void myFunc(Pointer<Int8>);
Which does not add any extra info.
And in contrast to the DynamicLibrary
API, we also won't have a Pointer<NativeFunction<Void Function(Pointer<Int8>)>>
type in our program that we would type check against.