ffi_native_invalid_multiple_annotations 진단: 한 선언에 @Native 애노테이션이 여러 개 있을 때
ffi_native_invalid_multiple_annotations 진단: 한 선언에 @Native 애노테이션이 여러 개 있을 때
Dart 분석기가 내보내는 진단에는 이름이 있어요. ffi_native_invalid_multiple_annotations는 한 선언에 @Native 애노테이션을 두 개 이상 붙였을 때 분석기가 알려주는 컴파일 타임 진단이에요. 한 함수에 네이티브 선언 정보는 하나면 충분해요.
본문
설명
분석기는 단일 선언에 Native 애노테이션이 두 개 이상 있을 때 이 진단을 만들어요.
예시
아래 코드는 함수 f에 Native 애노테이션이 두 개 달려 있어서 이 진단을 만들어요.
import 'dart:ffi';
@Native<Int32 Function(Int32)>()
@Native<Int32 Function(Int32)>(isLeaf: true)
external int f(int v);
흔한 해결 방법
애노테이션 중 하나만 남기고 나머지는 모두 제거해요.
import 'dart:ffi';
@Native<Int32 Function(Int32)>(isLeaf: true)
external int f(int v);