I'm using a package in my project called card_settings and it unfortunately depends on another package called flutter_cupertino_settings. Actually the last one does not support cupertino_icons v1.0.0 an I need to update icons package.
I've tried to use the forked repository by jibiel used to generate the pull request as flutter_cupertino_settings package override but I receive an error that I'm not able to solve:
Running "flutter pub get" in my_app...
Because my_app depends on dependency_overrides from unknown source "flutter_cupertino_settings", version solving failed.
pub get failed (1; Because my_app depends on dependency_overrides from unknown source "flutter_cupertino_settings", version solving failed.)
exit code 1
and this is my dependency override
card_settings: ^1.14.0
dependency_overrides:
flutter_cupertino_settings:
git:
url: https://github.com/jibiel/flutter_cupertino_settings.git
ref: dfb575c82b67ff76d6df240ccda9fefb53596709
Just paste this into your pubspec.yaml file:
card_settings: ^1.14.0
flutter_cupertino_settings: ^0.3.1
cupertino_icons: ^0.1.3
Related
Describe my issue, i have modularization project so will be have different pubspec.yaml, every pubspec i use package for testing :
mockito: ^5.0.8
build_runner: ^2.0.4
dependency_overrides:
analyzer: ^1.7.0
so after generate flutter pub run build_runner build --delete-conflicting-outputs i get issue's, then i search google i it this cause analyzer, then i follow step to change analyze version, still error, in this error :
(base) dendimuhmd#macbook-pro datasources % flutter pub run build_runner build
Changing current working directory to: /Users/dendimuhmd/Documents/dev/flutter/dicoding/creative-movie/core
Failed to build build_runner:build_runner:
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/resolver.dart:18:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';
^
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/analysis_driver.dart:9:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';
^
../../../../../../.pub-cache/hosted/pub.dartlang.org/build_resolvers-2.0.6/lib/src/build_asset_uri_resolver.dart:11:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.7.2/lib/src/clients/build_resolvers/build_resolvers.dart': No such file or directory
import 'package:analyzer/src/clients/build_resolvers/build_resolvers.dart';......
what is issue with analyzer, it this cause analyzer or?
Modularization structure
I have cloned a Repo of a Flutter project from my developer who has the App working perfectly on his machine, and opened the project in VS Code. I did flutter clean, then flutter pub get, and am getting an error as shown below. AFAIK when I clone the repo, I should get his exact files, so I don't understand how I am getting this error, but he does not? Does anyone know how to fix this? TIA for any and all help.
Because every version of charts_flutter from git depends on logging ^1.0.2 and signalr_client >=0.1.3 depends on logging ^0.11.3+2, charts_flutter from git is incompatible with signalr_client >=0.1.3.
So, because app1 depends on both signalr_client ^0.1.6 and charts_flutter from git, version solving failed.
Running "flutter pub get" in App1...
pub get failed (1; So, because app1 depends on both signalr_client ^0.1.6 and charts_flutter from git, version solving failed.)
The reason is simple
The both two packages depends on one common package
Signalr_client & Charts Flutter packages needs the logging package as a dependency.
See the pubspec file
https://github.com/soernt/signalr_client/blob/master/pubspec.yaml
https://github.com/google/charts/blob/master/charts_flutter/pubspec.yaml
But the versions are different for that.
Solution:
Try to remove the logger package from the pub_cache folder.
remote any one package signalr_client or charts_flutter.
use syncfusion_charts instead of charts_flutter
Try to update the flutter packages
Flutter 3.0 Give Error While Implementing both Flutter_html and pay In same project
Here is depency level i have used in my package:
pay: ^1.0.8
flutter_html: ^2.2.1
Error : Because flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 depends on flutter_svg >=0.22.0 <1.0.0 and pay_android >=1.0.6 depends on flutter_svg ^1.0.0, flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 is incompatible with pay_android >=1.0.6.
And because pay >=1.0.7 depends on pay_android ^1.0.6, flutter_html >=2.0.0-nullsafety.1 <3.0.0-alpha.1 is incompatible with pay >=1.0.7.
So, because project_name depends on both pay ^1.0.8 and flutter_html ^2.2.1, version solving failed.
pub finished with exit code 1
Hopefully today I re-search the package and found a temporary solution for this issue. you can use the prerelease version of the package it will remove the error.
flutter_html: ^3.0.0-alpha.3
you can find it after this line in pub.dev
Published 33 days ago• verified publisher iconsub6resources.comNull safety• Latest: 2.2.1 / Prerelease: 3.0.0-alpha.3
Here is a solution for those that want to use the 2.x.x version. The problem is the max flutter_svg version restriction, I have forked the project and updated the restriction.
- flutter_svg: '>=0.22.0 <1.0.0'
+ flutter_svg: '>=0.22.0 <2.0.0'
You can add this package from my fork or create your own. To add my fork use this code in your pubspec.yaml
flutter_html:
git:
url: https://github.com/AlmisSolutions/flutter_html.git
ref: main_lts
Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Process finished with exit code 66
/Users/H025712/development/flutter/bin/flutter --no-color pub get
Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Cause: Someone in your team (could be yourself) add a plugin from their local folder. This plugin can't be found when you try to update the dependency.
Quick fix: If you use remote git, let you teammate include that plugin in the project folder, modify the pubspec.yaml path, add it to stage, commit then push. In the case not using git remote, copy those files to your computer in the path as pub spec.yaml suggested.
Ideal fix: Let your teammate use public plugin or share that plugin in private with password, then let flutter download that plugin by flutter pub get/upgrade.
Check your pubspec.yaml is well ordered, I had badly composed dev_dependencies and it failed me
Talked to my tech lead, who is familiar with the code; he said to check out the missing code that was referencing overrides in the pubspec.yaml:
https://dart.dev/tools/pub/dependencies
Dependency overrides
You can use dependency_overrides to temporarily override all references to a dependency.
For example, perhaps you are updating a local copy of transmogrify, a
published library package. Transmogrify is used by other packages in
your dependency graph, but you don’t want to clone each package
locally and change each pubspec to test your local copy of
transmogrify.
In this situation, you can override the dependency using
dependency_overrides to specify the directory holding the local copy
of the package.
The pubspec would look something like the following:
name: my_app
dependencies:
transmogrify: ^1.2.0
dependency_overrides:
transmogrify:
path: ../transmogrify_patch/
These were my dependencies in my pubspec.yaml:
dependencies:
...
image_picker: ^0.8.4+2
...
And everything worked fine, but now I added this:
dependencies:
...
image_picker: ^0.8.4+2
...
image_editor_pro: ^1.1.8
And running pub get I have this error:
Because image_editor_pro >=1.1.0 depends on image_picker ^0.7.4 and provauth depends on image_picker ^0.8.4+2, image_editor_pro >=1.1.0 is forbidden.
So, because provauth depends on image_editor_pro ^1.1.8, version solving failed.
pub get failed (1; So, because provauth depends on image_editor_pro ^1.1.8, version solving failed.)
I tried downgrading my version of image_picker but I get a new error:
Cannot open file, path = 'C:\Users\loren\flutter.pub-cache_temp\dir60565baa\test\fixtures\invalid\n_structure_<.>.json' (OS Error: Syntax of the name of the file, of the directory or of volume is not correct (This is my bad translation of the error).
, errno = 123)
pub get failed (66; , errno = 123))
What can I do to solve and use both the dependencies?
You can try to override the dependency so only one version is used for your project. Something like this:
name: your_app
dependencies:
image_picker: ^0.8.4+2
image_editor_pro: ^1.1.8
dependency_overrides:
image_picker: '0.8.4+2' # Use only this version for all the code depended on image picker
But you need to thoroughly tested the library that depends on the overrided dependency to check if it not introducing you a new error.
See https://dart.dev/tools/pub/dependencies#dependency-overrides
Seems like there is a conflict with image_editor_pro because the package is old.
It is better to look for another updated package with null safety, like image_editor 1.0.2, this won't have conflictions with image_picker 0.8.4+1.
And if you are willing to downgrade. ## Downgrading is a pain
You might need to downgrade the other dependencies as well. which might lead to Downgrading the Dart version.
After downgrading execute this command:
flutter clean
Then delete pubspec.lock file.
If a conflict between dependencies occurs, the simplest solution is to remove the version numbers of the two dependencies and then replace them with 'any' without the quotes in front of it. Then run pub get.
Hope you can help