felangel / bloc

A predictable state management library that helps implement the BLoC design pattern
https://bloclibrary.dev
MIT License
11.87k stars 3.4k forks source link

build: Update test dependency of bloc_test package from 1.16.6 to the latest version #4204

Closed suprimpoudel closed 4 months ago

suprimpoudel commented 4 months ago

Because the test dependency for the bloc_test package is outdated, it is affecting some of my dependencies, preventing me from upgrading them to the latest versions.

Here is the error message caused by bloc_test, indicating a conflict with the latest version of the web_socket_channel package:

Because test >=1.16.0-nullsafety.19 <1.16.6 depends on test_api 0.2.19 and test >=1.16.6 <1.25.5 depends on web_socket_channel ^2.0.0, test >=1.16.0-nullsafety.19 <1.25.5 requires test_api 0.2.19 or web_socket_channel ^2.0.0.
And because test >=1.25.3 <1.25.6 depends on test_api 0.7.1, test >=1.16.0-nullsafety.19 <1.25.6 requires test_api 0.2.19 or 0.7.1 or web_socket_channel ^2.0.0.
And because test >=1.25.6 <1.25.8 depends on test_api 0.7.2 and test >=1.25.8 depends on test_api 0.7.3, test >=1.16.0-nullsafety.19 requires test_api 0.2.19 or 0.7.1 or 0.7.2 or 0.7.3 or web_socket_channel ^2.0.0.
Because no versions of bloc_test match >9.1.7 <10.0.0 and bloc_test 9.1.7 depends on test ^1.16.0, bloc_test ^9.1.7 requires test ^1.16.0.
Thus, bloc_test ^9.1.7 requires test_api 0.2.19 or 0.7.1 or 0.7.2 or 0.7.3 or web_socket_channel ^2.0.0.
And because every version of integration_test from sdk depends on test_api 0.7.0 and smart_sme depends on web_socket_channel ^3.0.1, bloc_test ^9.1.7 is incompatible with integration_test from sdk.
So, because smart_sme depends on both integration_test from sdk and bloc_test ^9.1.7, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on web_socket_channel: flutter pub add web_socket_channel:^2.4.5
felangel commented 4 months ago

Hi @suprimpoudel 👋 Thanks for opening an issue!

Can you please share a minimal pubspec.yaml that reproduces the issue? I'm happy to take a closer look.

suprimpoudel commented 4 months ago

Hi @felangel , Here is the pubspec.yaml for my project

environment:
  sdk: '>=3.4.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  carousel_slider: ^4.2.1
  connectivity_plus: ^6.0.3
  convert: ^3.1.1
  cupertino_icons: ^1.0.8
  crypto: ^3.0.3
  decimal: ^3.0.2
  device_info_plus: ^10.1.0
  dio: ^5.5.0+1
  esc_pos_utils_plus: ^2.0.3
  equatable: ^2.0.5
  excel: ^4.0.3
  file_picker: ^8.0.6
  firebase_analytics: ^11.2.0
  firebase_core: ^3.2.0
  firebase_crashlytics: ^4.0.3
  firebase_messaging: ^15.0.3
  fl_chart: ^0.68.0
  flutter_barcode_listener: ^0.1.4
  flutter_bloc: ^8.1.6
  flutter_keyboard_visibility: ^6.0.0
  flutter_local_notifications: ^17.2.1+2
  flutter_native_splash: ^2.4.1
  flutter_secure_storage: ^9.2.2
  flutter_speed_dial: ^7.0.0
  flutter_slidable: ^3.1.1
  flutter_svg: ^2.0.10+1
  flutter_typeahead: ^5.2.0
  get_it: ^7.7.0
  image_picker: ^1.1.2
  in_app_update: ^4.2.3
  intl: ^0.19.0
  local_auth: ^2.2.0
  mobile_scanner: ^5.1.1
  nepali_date_picker: ^6.0.1
  open_filex: ^4.4.0
  path_provider: ^2.1.3
  pdf: ^3.11.0
  permission_handler: ^11.3.1
  pinput: ^5.0.0
  qr_flutter: ^4.1.0
  shared_preferences: ^2.2.3
  step_progress_indicator: ^1.0.2
  sqflite: ^2.3.3+1
  super_tooltip: ^2.0.8
  url_launcher: ^6.3.0
  # TODO: Update the dependency to latest version once bloc_test's test dependency updates
  #  The package bloc_test test dependency and web_socket_channel test
  #  dependency conflicts because of version, so cannot update the dependency to the latest one as of July 17, 2024
  web_socket_channel: ^2.4.5

dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter
  bloc_test: ^9.1.7
  build_runner: ^2.4.11
  flutter_lints: ^4.0.0
  http_mock_adapter: ^0.6.1
  mockito: ^5.4.4
  sqflite_common_ffi: ^2.3.3

flutter:
  generate: true
  uses-material-design: true

  assets:
    - asset/images/

Here I cant update my web_socket_channel dependency because of it conflict with bloc_test package

felangel commented 4 months ago

Thanks I'll take a closer look shortly, apologies for the delay!

felangel commented 4 months ago

@suprimpoudel just took a look and this isn't a problem in bloc_test. The package:test version constraint in bloc allows the latest version of package:test.

You can see this via the following pubspec.yaml:

name: example
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0

environment:
  sdk: '>=3.4.4 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  web_socket_channel: ^3.0.0

dev_dependencies:
  test: ^1.25.8
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

Running flutter packages get results in:

✖ flutter packages get
Resolving dependencies... 
Note: test_api is pinned to version 0.7.0 by flutter_test from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.

Because every version of flutter_test from sdk depends on test_api 0.7.0 and test >=1.25.8 depends on test_api 0.7.3, flutter_test from sdk is
  incompatible with test >=1.25.8.
So, because example depends on both test ^1.25.8 and flutter_test from sdk, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Try updating the following constraints: flutter pub add flutter:'{"version":"^0.0.0","sdk":"flutter"}' dev:flutter_test:'{"version":"^0.0.0","sdk":"flutter"}' dev:test:^1.25.2 web_socket_channel:^2.4.5

The problem is you need to upgrade you web_socket_channel dependency to ^3.0.0 and use the master channel of Flutter (since this requires test_api: 0.7.3).

Eventually the changes in master will make it to stable and you should be able to upgrade to web_socket_channel ^3.0.0 on the stable channel as well.