flutter pub get error when i edit my pubspec.yaml file - flutter

I have an error when i try to add a new plugin in my pubspec.yaml
i add the plugin : easy_localization: ^3.0.0
And i have this error message :
Because flutter_launcher_icons >=0.7.0 <0.9.0 depends on args ^1.5.0 and easy_localization >=3.0.0-nullsafety depends on args ^2.0.0, flutter_launcher_icons >=0.7.0 <0.9.0 is incompatible with easy_localization >=3.0.0-nullsafety.
So, because gameapp depends on both easy_localization ^3.0.0 and flutter_launcher_icons ^0.8.0, version solving failed.
pub get failed (1; So, because gameapp depends on both easy_localization ^3.0.0 and flutter_launcher_icons ^0.8.0, version solving failed.)

Could you try adding,
flutter_launcher_icons: ^0.9.0
args: ^2.0.0
easy_localization: ^3.0.0-nullsafety
to your pubspec.yaml and try saving it again to reload the packages?

The problem is: The library version you want to use is newer than Flutter, and there are two solutions
1: Go to the library website and click on the version and install an old library, for example (easy_localization: ^ 2.3.3)
2: Install the latest version of Flutter. Flutter2

Related

How use open_file and file_picker packages together in flutter?

I want to use both file_picker package and the open_file package but their latest versions is not compatible with eachother as you can se in the error message below.open_file has not been updated for the last 18 months so maybe it starts to get depricated?
Maybe there is another way to open a file instead of the open_file package?
Because if I want to use them both I have to switch to a very old version of file_picker.
The error message:
Because open_file >=3.1.0 depends on ffi ^1.0.0 and file_picker 5.2.4 depends on ffi ^2.0.1, open_file >=3.1.0 is incompatible with file_picker 5.2.4.
And because no versions of file_picker match >5.2.4 <6.0.0, open_file >=3.1.0 is incompatible with file_picker ^5.2.4.
So, because my_app depends on both file_picker ^5.2.4 and open_file ^3.2.1, version solving failed.
pub get failed (1; So, because my_app depends on both file_picker ^5.2.4 and open_file ^3.2.1, version solving failed.)
Override the package's ffi dependency Add dependency_overrides to pubspec.yaml
dependency_overrides:
ffi: ^2.0.1

Flutter pubspec dependency conflict

I've a wired problem with resolving dependencies. In my application pubspec I've following lines:
dependencies:
yet_another_layout_builder: ^0.1.0
dev_dependencies:
hive_generator: ^1.1.1
both packages uses analyzer package and flutter pub get reports me an error:
Because no versions of hive_generator match >1.1.1 <2.0.0 and hive_generator 1.1.1 depends on analyzer >=1.0.0 <3.0.0, hive_generator ^1.1.1 requires analyzer >=1.0.0 <3.0.0.
And because every version of yet_another_layout_builder depends on analyzer ^3.0.0, hive_generator ^1.1.1 is incompatible with yet_another_layout_builder.
So, because testApp depends on both yet_another_layout_builder ^0.1.0 and hive_generator ^1.1.1, version solving failed.
pub get failed (1; So, because testApp depends on both yet_another_layout_builder ^0.1.0 and hive_generator ^1.1.1, version solving failed.)
However when I look into github sources for those packages, it looks for me that this error shouldn't happen. For hive_generator pubspec have following restrictions:
dependencies:
analyzer: ">=1.0.0 <4.0.0"
and for YetAnotherLayoutBuilder pubspec have:
dependencies:
analyzer: ^3.0.0
So if I understands this notation correctly:
YetAnotherLayoutBuilder expects analyzer in version >=3.0.0 and <4.0.0
hive_generator expects analyzer in version >=1.0.0 and <4.0.0
Any suggestions where I'm mistaken are gladly welcome.
Right now nether hive_generator plugin have any upgrade then this version and nor yet_another_layout_builder has downgrade version. So to tackle these kinds of scenarios we have another method to add dependencies in Flutter which is dependency_overrides using this we can override some dependencies so that our app can use another version of the same dependency as well. So just add below code to your pubspecs.yaml file
dependency_overrides:
analyzer: ^2.8.0

Flutter theme version solving failed

I am trying to run a flutter theme code in visual studio code and facing this issue after running command (flutter run)
Because every version of flutter_test from sdk depends on vector_math 2.1.0-nullsafety.5 and fstore depends on vector_math 2.0.8, flutter_test from sdk is forbidden.
So, because fstore depends on flutter_test any from sdk, version solving failed.
Running "flutter pub get" in ecomputex...
pub get failed (1; So, because fstore depends on flutter_test any from sdk, version solving failed.)
Please helpenter image description here
just add this line of code in your pubspec
dependency_overrides:
vector_math: 2.1.0-nullsafety.5
this will override the dependency, and you can use whatever version you want. you might need to change it the version of the package.
my code example:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
file_picker: ^3.0.0
hive: ^2.0.0
hive_flutter: ^1.0.0
dependency_overrides:
path_provider: 2.0.1

version solving failed when try get pubspec.yaml

I facing issue that show up to me that message when Trying to get packages
Running "flutter pub get" in stok_app_a...
Because no versions of in_app_purchase match >0.2.2+4 <0.3.0 and in_app_purchase 0.2.2+4 depends on json_annotation ^2.0.0, in_app_purchase ^0.2.2+4 requires json_annotation ^2.0.0.
And because every version of speech_to_text depends on json_annotation
^3.0.0, in_app_purchase ^0.2.2+4 is incompatible with speech_to_text.
So, because stok_app_a depends on both speech_to_text ^0.7.0 and
in_app_purchase ^0.2.2+4, version solving failed. pub get failed (1;
So, because stok_app_a depends on both speech_to_text ^0.7.0 and
in_app_purchase ^0.2.2+4, version solving failed.) exit code 1
I solved this issue by assignment dependency_overrides in pubspec.yaml file like that
dependency_overrides:
json_annotation: ^2.0.0
to override the json_annotation 2.0.0

Flutter simple_slider installation problem

flutter_cache_manager and cached_network_image is successfully instaled.
flutter_cache_manager: ^1.1.3
cached_network_image: ^1.1.3
When try install simple_slider: ^0.0.2 get below error
Because every version of simple_slider depends on cached_network_image ^0.4.1 and first_flutter_app depends on cached_network_image ^1.1.3, simple_slider is forbidden.
So, because first_flutter_app depends on simple_slider ^0.0.2, version solving failed.
pub get failed (1)
try:
simple_slider: any
hope it helped