Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My generated dart file is getting errors like missing_const_final_var_or_type and implicit_this_reference_in_initializer #31

Closed
Cronnay opened this issue Feb 13, 2022 · 2 comments

Comments

@Cronnay
Copy link

Cronnay commented Feb 13, 2022

Hi!

Copied this example. My pubspec:

dependencies:
  flutter:
    sdk: flutter
  ffi: ^1.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  ffigen: 4.1.3

ffigen:
  name: NativeLibrary
  description: Bindings to `headers/example.h`.
  output: 'lib/generated_bindings.dart'
  headers:
    entry-points:
      - 'rust/bindings.h'

My header is only 1 row and is: void start_application(void);.
So when I run flutter pub run ffigen it creates a dart file with errors like: Variables must be declared using the keywords 'const', 'final', 'var' or a type name. Try adding the name of the type of the variable or the keyword 'var'. and then The instance member '_start_applicationPtr' can't be accessed in an initializer. Try replacing the reference to the instance member with a different expression

Any clue why I get these errors?

@alexandru-calinoiu
Copy link

Same here, have you found an answer to this issue ?

@Cronnay
Copy link
Author

Cronnay commented Feb 13, 2022

Yes. I had to increase the sdk version requirement in my pubspec. sdk: ">=2.16.1 <3.0.0"

@Cronnay Cronnay closed this as completed Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants