DeepSource has joined Harness. Learn more
Dart Analyze logoDart Analyze/
DRT-W1256

Cannot implement `Finalizable` for a subclass of `Struct` or `Union`DRT-W1256

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a subclass of either Struct or Union implements Finalizable.

For more information about FFI, see C interop using dart:ffi.

Example

The following code produces this diagnostic because the class S implements Finalizable:

import 'dart:ffi';

final class S extends Struct implements Finalizable {
  external Pointer notEmpty;
}

Common fixes

Try removing the implements clause from the class:

import 'dart:ffi';

final class S extends Struct {
  external Pointer notEmpty;
}