Closed shaxxx closed 3 years ago
Since https://github.com/dart-lang/sdk/issues/44622, Utf8
is subclass of Opaque
, which is designed to be uninstantiatable
/// [Opaque]'s subtypes represent opaque types in C.
///
/// [Opaque]'s subtypes are not constructible in the Dart code and serve purely
/// as markers in type signatures.
abstract class Opaque extends NativeType {}
Use Uint8
instead
Pointer<ffi.Utf8> pointer = ffi.malloc<Uint8>(256).cast();
Currently, using this package as dependency causes compile error
Offending line is
Pointer<ffi.Utf8> string = ffi.malloc(256);
Seems this is known issue https://github.com/flutter/flutter/issues/76705
To resolve it, ffi package dependency needs to be updated to latest version (currently 1.1.2)