ffi_ native_ invalid_ multiple_ annotations
Details about the 'ffi_native_invalid_multiple_annotations' diagnostic produced by the Dart analyzer.
Native functions and fields must have exactly one
@Native annotation.
Description
#
The analyzer produces this diagnostic when there is more than
one Native
annotation on a single declaration.
Example
#
The following code produces this diagnostic because the
function f has two
Native annotations associated with it:
import 'dart:ffi';
@Native<Int32 Function(Int32)>()
@Native<Int32 Function(Int32)>(isLeaf: true)
external int f(int v);
Common fixes
#Remove all but one of the annotations:
import 'dart:ffi';
@Native<Int32 Function(Int32)>(isLeaf: true)
external int f(int v);
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.