abi_specific_integer_mapping_extra
Classes extending 'AbiSpecificInteger' must have exactly one 'AbiSpecificIntegerMapping' annotation specifying the mapping from ABI to a 'NativeType' integer with a fixed size.
Description
#The analyzer produces this diagnostic when a class that extends
AbiSpecificInteger
has more than one AbiSpecificIntegerMapping
annotation.
Example
#The following code produces this diagnostic because there are two
AbiSpecificIntegerMapping
annotations on the class C
:
dart
import 'dart:ffi';
@AbiSpecificIntegerMapping({Abi.macosX64 : Int8()})
@AbiSpecificIntegerMapping({Abi.linuxX64 : Uint16()})
final class C extends AbiSpecificInteger {
const C();
}
Common fixes
#Remove all but one of the annotations, merging the arguments as appropriate:
dart
import 'dart:ffi';
@AbiSpecificIntegerMapping({Abi.macosX64 : Int8(), Abi.linuxX64 : Uint16()})
final class C extends AbiSpecificInteger {
const C();
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。