grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
855 stars 268 forks source link

Can't use with Flutter because of crypto constraint #321

Closed chalin closed 4 years ago

chalin commented 4 years ago

Excerpt from the current pubspec.yaml:

dependencies:
  crypto: ^2.1.5

When I try to use grpc-dart ^2.2.0 in a simple Flutter client app (using Flutter@stable v1.17.5), I get the following dependency error:

Running "flutter pub get" in myapp...                           
Because every version of flutter_test from sdk depends on crypto 2.1.4 and grpc 2.2.0 depends on crypto ^2.1.5, flutter_test from sdk is incompatible with grpc 2.2.0.

From the crypto Changelog we can read:

2.1.5

  • Improve example and package description to address package site maintenance suggestions.

    2.1.4

  • BugFix: ...

Given that v2.1.5 only updated descriptions, is there any reason not to depend on crypto ^2.1.4 instead?

Note: There is of course a workaround: to use a dependency override in my app, but I'd rather avoid that if possible especially since I'm putting this together for use in a simple tutorial.

wayne-li2 commented 4 years ago

As a workaround, can you write your tutorial in grpc 2.1.3?

wayne-li2 commented 4 years ago

Otherwise, on flutter beta channel, flutter_test is compatible with crypto 2.1.5

BstevensG4G commented 4 years ago

I'm a beginner trying to use the grpc package, are the instructions for installing different or is package using lower cryto version?

wayne-li2 commented 4 years ago

@BstevensG4G This grpc package has dependencies crypto ^2.1.5, which means the version must be equal or higher than v2.1.5, and less than v2.2.0

Flutter stable currently has a hard dependency on crypto 2.1.4, which means you must use crypto v2.1.4

Therefore if you try to use grpc with Flutter together, you won't be able to fully resolve dependencies.

As a workaround, you can bump the grpc version down to a previous version, which depended on crypto 2.1.4, or you may use the flutter beta channel, which has upgraded crypto to 2.1.5. Your choice!