non_sized_type_argument
The type '{1}' isn't a valid type argument for '{0}'. The type argument must be a native integer, 'Float', 'Double', 'Pointer', or subtype of 'Struct', 'Union', or 'AbiSpecificInteger'.
Description
#The analyzer produces this diagnostic when the type argument for the class Array
isn't one of the valid types: either a native integer, Float
, Double
, Pointer
, or subtype of Struct
, Union
, or AbiSpecificInteger
.
For more information about FFI, see C interop using dart:ffi.
Example
#The following code produces this diagnostic because the type argument to Array
is Void
, and Void
isn't one of the valid types:
import 'dart:ffi';
final class C extends Struct {
@Array(8)
external Array<Void> a0;
}
Common fixes
#Change the type argument to one of the valid types:
import 'dart:ffi';
final class C extends Struct {
@Array(8)
external Array<Uint8> a0;
}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.