I'm getting a compilation error in a generated mocks class, here's the popup help message from Android Studio:
The class '_FakePointer_10' can't implement '_i6.Pointer'.
Try extending 'Struct' or 'Union'.
dart:ffi class Pointer extends NativeType
Represents a pointer into the native C memory. Cannot be extended.
Dart Packages
... and here's all of the generated lines containing '_i6':
import 'dart:ffi' as _i6;
...
class _FakePointer_10<T extends _i6.NativeType> extends _i1.Fake
implements _i6.Pointer<T> {}
(the _i6.Pointer<T>
here has the red underline)
...
@override
_i6.Pointer<Never> get nullPointer =>
(super.noSuchMethod(Invocation.getter(#nullPointer),
returnValue: _FakePointer_10<Never>()) as _i6.Pointer<Never>);
...
@override
_i6.Pointer<_i6.Uint8> intListToArray(List<int>? list) =>
(super.noSuchMethod(Invocation.method(#intListToArray, [list]),
returnValue: _FakePointer_10<_i6.Uint8>()) as _i6.Pointer<_i6.Uint8>);
... and these are from my code (I believe these are the source for those last 2 blocks of generated code):
final Pointer<Never> nullPointer = Pointer.fromAddress(0);
...
Pointer<Uint8> intListToArray(List<int> list) {
final Pointer<Uint8> ptr =
malloc.allocate<Uint8>(sizeOf<Uint8>() * list.length);
for (var i = 0; i < list.length; i++) {
ptr.elementAt(i).value = list[i];
}
return ptr;
}
How can I get around this problem?