I’m facing dependency conflicts in my Flutter project when using the package_info_plus
package. The issue comes because package_info_plus
has specific version requirements for the http
package, which are incompatible with other packages in my project. Despite multiple attempts to resolve the conflicts by adjusting to specific version, I am still lost in finding a compatible combination. I need assistance in resolving these conflicts or finding an alternative package to retrieve package information without removing other dependencies. Thanks.
environment:
sdk: '>=3.1.0 <4.0.0'
dependencies:
flutter:
sdk: flutter
file: ^7.0.0
shared_preferences: ^2.0.13
flutter_localizations:
sdk: flutter
intl: any
get_storage: ^2.1.1
get_cli: ^1.8.1
local_session_timeout: ^2.3.1
go_router: ^14.1.2
casbin: ^0.1.0
jwt_decoder: ^2.0.1
flex_color_scheme: ^7.3.1
one_clock: ^2.0.1
cupertino_icons: ^1.0.2
flutter_dotenv: ^5.1.0
json_serializable: ^6.7.1
firebase_core: ^2.24.2
firebase_messaging: ^14.7.9
openid_client: ^0.4.8
hive: ^2.2.3
hive_flutter: ^1.1.0
flutter_svg: ^2.0.10+1
http: ^1.2.0
flutter_json_view: ^1.1.4
get: ^4.6.6
url_launcher: ^6.2.5
internet_connection_checker_plus: ^2.3.0
json_annotation: ^4.9.0
dio: any
provider: ^6.1.2
freezed_annotation: ^2.4.1
footer: ^0.0.4
font_awesome_flutter: ^10.7.0
I attempted to update the version constraints of conflicting packages such as http and internet_connection_checker_plus to resolve dependency conflicts. and also I tried excluding certain dependencies to see if it relived the conflicts, but it resulted in other issues within my project.
But none of it worked..
Error
Because get_cli >=1.8.3 depends on intl ^0.18.0 and no versions of
get_cli match >1.8.1 <1.8.3, get_cli >1.8.1 requires intl ^0.18.0.
And because get_cli 1.8.1 depends on cli_dialog >=0.5.0 <1.0.0, get_cli >=1.8.1 requires intl ^0.18.0 or cli_dialog >=0.5.0 <1.0.0.
(1) So, because no versions of cli_dialog match >0.5.0 <1.0.0 and
cli_dialog 0.5.0 depends on dart_console ^1.0.0, get_cli >=1.8.1
requires intl ^0.18.0 or dart_console ^1.0.0.Because no versions of dart_console match >1.0.0 <1.1.0-pre.0 and dart_console >=1.1.0-pre.0 <1.2.0 depends on intl ^0.17.0,
dart_console >1.0.0 <1.2.0 requires intl ^0.17.0.
And because dart_console >=1.2.0 <4.0.0 depends on intl ^0.18.0 and dart_console 1.0.0 depends on win32 ^2.0.0, dart_console >=1.0.0
<4.0.0 requires win32 ^2.0.0 or intl ^0.17.0 or ^0.18.0.
And because get_cli >=1.8.1 requires intl ^0.18.0 or dart_console ^1.0.0 (1), get_cli >=1.8.1 requires intl ^0.17.0 or >=0.18.0 <0.19.0
or win32 ^2.0.0.
And because package_info_plus >=4.0.1 depends on win32 >=4.0.0 <6.0.0, if package_info_plus >=4.0.1 and get_cli >=1.8.1 then intl
^0.17.0 or >=0.18.0 <0.19.0.
And because mes_line_in depends on flutter_localizations from sdk which depends on intl 0.19.0, package_info_plus >=4.0.1 is
incompatible with get_cli >=1.8.1.
So, because mes_line_in depends on both get_cli ^1.8.1 and package_info_plus ^7.0.0, version solving failed.
2
Answers
Try removing the
pubspec.lock
file from the root of your project and thenrun the
flutter pub get
command in the terminal.I believe this will solve your project’s dependency conflict.
try use:
package_info_plus: ^5.0.1