Skip to content

false ffi_native_unexpected_number_of_parameters error on getters #49563

@goderbauer

Description

@goderbauer

In flutter we are getting the following analyzer error on a bunch of getters annotated with @FfiNative:

  error • text.dart:2714:3 • Unexpected number of FfiNative annotation parameters. Expected 1 but has 0. Make sure parameters match the function annotated. •
          ffi_native_unexpected_number_of_parameters

The code appears to be working correctly, so I think this is a bug in the analyzer.

Examples of where we are getting this error:

@pragma('vm:entry-point')
class Paragraph extends NativeFieldWrapperClass1 {
  // ...

  // see https://github.com/flutter/engine/blob/862773f0d9093b97271237b31e379dde890b0b69/lib/ui/text.dart#L2709-L2712
  @FfiNative<Double Function(Pointer<Void>)>('Paragraph::ideographicBaseline', isLeaf: true)
  external double get ideographicBaseline;

  // ...

  // see https://github.com/flutter/engine/blob/862773f0d9093b97271237b31e379dde890b0b69/lib/ui/text.dart#L2714-L2722
  @FfiNative<Bool Function(Pointer<Void>)>('Paragraph::didExceedMaxLines', isLeaf: true)
  external bool get didExceedMaxLines;

  // ...
}

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failurescustomer-flutterlegacy-area-analyzerUse area-devexp instead.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions