simolus3 / drift

Drift is an easy to use, reactive, typesafe persistence library for Dart & Flutter.
https://drift.simonbinder.eu/
MIT License
2.59k stars 366 forks source link

Issue No named parameter with the name 'connectTimeout' #3255

Open markjoseultra opened 1 week ago

markjoseultra commented 1 week ago

Describe the bug

I am getting this error log when adding amplify_storage_s3: ^2.4.1

Launching lib\main.dart on sdk gphone x86 in debug mode... ../../../AppData/Local/Pub/Cache/hosted/pub.dev/drift_flutter-0.2.0/lib/src/native.dart:61:42: Error: No named parameter with the name 'connectTimeout'. return await isolate.connect(connectTimeout: connectTimeout); ^^^^^^^^^^^^^^ ../../../AppData/Local/Pub/Cache/hosted/pub.dev/drift_flutter-0.2.0/lib/src/native.dart:112:7: Error: No named parameter with the name 'port'. port: connections, ^^^^ ../../../AppData/Local/Pub/Cache/hosted/pub.dev/drift-2.18.0/lib/isolate.dart:178:11: Context: Found this candidate, but the arguments don't match. factory DriftIsolate.inCurrent(DatabaseOpener opener, ^^^^^^^^^ Target kernel_snapshot_program failed: Exception 2

FAILURE: Build failed with an exception.

I have created a sample project to replicate the problem I just added amplify_storage_s3: ^2.4.1 and the error above happened if you could teach me a fix that would be great TIA. https://github.com/markjoseultra/flutter_drift_test

simolus3 commented 1 week ago

Despite claiming to support older drift versions - drift_flutter actually requires a more recent version of the core drift package. This will be fixed in the next drift version, but that won't help you if you have another package depending on older drift versions (like Amplify).

Does adding this to your pubspec solve the issue?

dependency_overrides:
  drift: ^2.20.3
markjoseultra commented 1 week ago

I will not be able to use the latest version of drift Because no versions of location match >7.0.0 <8.0.0 and location 7.0.0 depends on location_web ^5.0.3, location ^7.0.0 requires location_web ^5.0.3. And because no versions of location_web match >5.0.3 <6.0.0, location ^7.0.0 requires location_web 5.0.3. And because location_web 5.0.3 depends on web ^0.5.1 and drift >=2.19.2 depends on web ^1.0.0, location ^7.0.0 is incompatible with drift >=2.19.2. So, because flexiform depends on both drift ^2.20.3 and location ^7.0.0, version solving failed.

simolus3 commented 1 week ago

Judging by the few changes required in https://github.com/Lyokone/flutterlocation/pull/989, you might get away with also adding web: ^1.0.0 to the dependency overrides section.

simolus3 commented 1 week ago

If you can't use the latest drift, try downgrading drift_flutter by using drift_flutter: '>=0.1.0 <0.2.0'

markjoseultra commented 1 week ago

I can't also use drift_flutter 0.1.0

Because amplify_db_common_dart 0.4.6 depends on sqlite3 >=2.0.0 <2.4.3 and no versions of amplify_db_common_dart match >0.4.6 <0.5.0, amplify_db_common_dart ^0.4.6 requires sqlite3 >=2.0.0 <2.4.3. And because drift_flutter <0.2.0 depends on sqlite3 ^2.4.4, drift_flutter <0.2.0 is incompatible with amplify_db_common_dart ^0.4.6. And because amplify_storage_s3_dart 0.4.5 depends on amplify_db_common_dart ^0.4.6 and no versions of amplify_storage_s3_dart match >0.4.5 <0.5.0, drift_flutter <0.2.0 is incompatible with amplify_storage_s3_dart ^0.4.5. And because amplify_storage_s3 2.4.1 depends on amplify_storage_s3_dart ^0.4.5 and no versions of amplify_storage_s3 match >2.4.1 <3.0.0, drift_flutter <0.2.0 is incompatible with amplify_storage_s3 ^2.4.1. So, because flexiform depends on both amplify_storage_s3 ^2.4.1 and drift_flutter ^0.1.0, version solving failed.