Search code examples
flutterdartpubspec

I am trying to add flutter blue in my pubspec.yaml file, but version solving is failed


I am trying to add flutter blue in my pubspec.yaml file, but version solving is failed but it does not seem to support existence with flutter reactive ble in the same pubspec.yaml file.

The following is my pubspec.yaml file:

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  image_picker:
  http: ^0.12.0+4
  flutter_bloc: ^4.0.0
  equatable: ^1.0.0
  shared_preferences: ^0.5.7
  fluttertoast: ^8.0.8
  flutter_spinkit: "^4.1.2"
  intl: ^0.16.1
  auto_orientation: 2.1.0
  exif: ^1.0.2
  image: ^2.1.4
  flutter_exif_rotation: 0.3.0
  animated_floatactionbuttons: ^0.1.0
  ffi: ^1.0.0
  provider: ^4.0.5
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  get: ^4.6.1
  flutter_reactive_ble: ^3.1.1+1
  js: ^0.6.3
  flutter_launcher_icons: ^0.8.1


dev_dependencies:
  flutter_test:
    sdk: flutter

In the terminal, when I run,

flutter pub add flutter_blue

And I am getting the following error:

Because flutter_blue <0.4.0 requires SDK version >=1.8.0 <2.0.0 and flutter_blue >=0.4.0 <0
.4.2 depends on protobuf ^0.9.1, flutter_blue <0.4.2 requires protobuf ^0.9.1.
And because flutter_blue >=0.4.2 <0.6.0 depends on protobuf ^0.10.5, flutter_blue <0.6.0 re
quires protobuf ^0.9.1 or ^0.10.5.
And because flutter_blue >=0.6.0 <0.6.1 depends on protobuf ^0.13.12 and flutter_blue >=0.6
.1 <0.6.3+1 depends on protobuf ^0.14.1, flutter_blue <0.6.3+1 requires protobuf ^0.9.1 or
^0.10.5 or ^0.13.12 or ^0.14.1.
And because flutter_blue >=0.6.3+1 <0.7.2 depends on protobuf ^1.0.0 and flutter_blue ^0.7.
2 depends on protobuf ^1.0.1, flutter_blue <0.8.0 requires protobuf ^0.9.1 or ^0.10.5 or ^0
.13.12 or ^0.14.1 or >=1.0.0 <2.0.0.
And because flutter_reactive_ble ^3.0.0 depends on protobuf ^2.0.0 and flutter_blue >=0.8.0
 depends on convert ^3.0.0, if flutter_reactive_ble ^3.0.0 and flutter_blue any then conver
t ^3.0.0.
And because attendanceapp depends on exif ^1.0.2 which depends on convert ^2.0.0, flutter_r
eactive_ble ^3.0.0 is incompatible with flutter_blue.
So, because attendanceapp depends on both flutter_reactive_ble ^3.1.1+1 and flutter_blue an
y, version solving failed.
pub finished with exit code 65

Now if the change to A SDK version, as stated, I am getting so many other errors. All dependencies match this project except the flutter blue.

The project completely works fine without the addition of flutter blue.

If I upgrade the packages, I still cannot match the flutter blue with my other dependencies I am using.

I scratching my head and I don't know which flutter blue versions I should be using.

Please assist me someone.


Solution

  • I set flutter_blue to 0.7.0 and flutter_reactive_ble to 2.7.3. I am not sure that so old versions contain all the features you need. But pug get shows no errors with this set of versions

    environment:
      sdk: ">=2.2.2 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      image_picker:
      http: ^0.12.0+4
      flutter_bloc: ^4.0.0
      equatable: ^1.0.0
      shared_preferences: ^0.5.7
      fluttertoast: ^8.0.8
      flutter_spinkit: "^4.1.2"
      intl: ^0.16.1
      auto_orientation: 2.1.0
      exif: ^1.0.2
      image: ^2.1.4
      flutter_exif_rotation: 0.3.0
      animated_floatactionbuttons: ^0.1.0
      ffi: ^1.0.0
      provider: ^4.0.5
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2
    
      get: ^4.6.1
      flutter_reactive_ble: 2.7.3
      js: ^0.6.3
      flutter_launcher_icons: ^0.8.1
      flutter_blue: 0.7.0
    

    enter image description here