dart-archive / ffi

Utilities for working with Foreign Function Interface (FFI) code

Home Page:https://pub.dev/packages/ffi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The specified language version is too high. The highest supported language version is 3.2

mfurkanyuceal opened this issue · comments

image

Flutter version => 3.16.5
Dart Version => 3.2.3

ffi version => ^2.1.0

After this commit, I cannot build the project. I am getting the error I shared in the picture.
If I reference the previous commit in the pubspec.yaml file, I can build a project.

Do you have a valid dependency resolution -- dart pub get?

or flutter pub get (this can be very important after upgrading/downgrading the flutter SDK or changing flutter channel).

If you set your dependency to ffi: ^2.1.0 it should not resolve to 2.1.1 because 2.1.1 has an SDK constraint of sdk: '>=3.3.0-279.1.beta <4.0.0'. What steps did get you this error message?

@dcharkes

  1. flutter clean
  2. flutter pub get
  3. flutter pub upgrade
  4. flutter build apk

in pubspec.lock file, ffi version is showing these
image

And the contents of your pubspec.yaml?

@jonasfj Does pub upgrade not respect SDK constraints?

That should resolve ffi to 2.1.0, not to 2.1.1.

Does running flutter pub get after upgrade fix the issue?

  1. flutter clean
  2. flutter pub get
  3. flutter pub upgrade
  4. flutter pub get
  5. flutter build apk

@jonasfj Does pub upgrade not respect SDK constraints?

It does

I found why. This result is obtained due to the ''^" character. If I give 2.1.0 instead of ^2.1.0, such a problem does not occur. The version information appears as 2.1.0 in the pubspec.lock file.
@jonasfj @dcharkes

The image in #231 (comment) suggests you've overwritten the dependency constraint.

If you use dependency_overrides you're on your own. Packages might not be compatible.
See: https://dart.dev/tools/pub/dependencies#dependency-overrides


In this case ffi 2.1.1 is not compatible with Dart 3.2. If you use pub get (and don't have overrides), you'll never get ffi 2.1.1, because Dart 3.2 doesn't satisfy the SDK constraint in 2.1.1.

You just need to have a dependency on ffi: ^2.1.0, if you try to do ffi: ^2.1.1 you'll get a conflict, if you resolve the conflict using a dependency_override, you've explicitly said you don't care they are not compatible. When you don't care about that, you are liable to get weird bugs.

I found why. This result is obtained due to the ''^" character. If I give 2.1.0 instead of ^2.1.0, such a problem does not occur. The version information appears as 2.1.0 in the pubspec.lock file.

That's probably wrong.

More likely you have a dependency_override.

I found why. This result is obtained due to the ''^" character. If I give 2.1.0 instead of ^2.1.0, such a problem does not occur. The version information appears as 2.1.0 in the pubspec.lock file.

That's probably wrong.

More likely you have a dependency_override.

The reason I use dependency override is the ffi version incompatibility between the other packages I use. I was using override in the same way before.
When I set the ffi version as I said, I can build.

https://dart.dev/tools/pub/dependencies#caret-syntax

if you set it to 2.1.0 then yes it'll build.

Hopefully, you won't need dependency_overrides, if you need it for other packages consider resolving that.

And always report dependency_overrides when filing bugs. If you use dependency_overrides getting weird errors not necessarily a bug 🤣

To be clear: 2.1.0 just means you're forcing the version. Instead of taking a version constraint.

If using dependency_overrides that makes sense, you're essentially doing version resolution manually.