"Please upgrade your dependency to build_web_compilers: ">=2.0.0", but it already is - angular-dart

I have an AngularDart-based web project. When I'm try webdev serve, I get this:
[SEVERE] Support for dartdevc in build_web_compilers < 2.0.0 has been removed.
Please upgrade your dependency to:
dev_dependencies:
build_web_compilers: ">=2.0.0"
[SEVERE] Exception: dartdevc is no longer supported by this version
However, I already have the dependency set to "2.0.0 and newer". Here is my pubspec.yaml file:
name: myproject
description: My Description
environment:
sdk: '>=2.3.3 <3.0.0'
dependencies:
angular: ^5.2.0
angular_components: ^0.13.0
dev_dependencies:
angular_test: ^2.2.0
build_runner: ^1.5.0
build_test: ^0.10.3
build_web_compilers: ^2.0.0
pedantic: ^1.0.0
test: ^1.5.1
I tried pub get, pub upgrade, pub activate global webdev, even pub cache repair.
In general, I seem to have problems with dependencies when creating AngularDart projects, even when I use versions from the Dart docs. Is there a magic way to know exactly which version numbers to use?

Try deleting your .dart_tool directory, rerun pub get and try again.
That directory is where dart stores all of the dependencies and artifacts of the build process. Sometimes it can get in an odd state.
Whenever your Dart build is misbehaving in ways that defy explanation, it is good practice to delete the .dart_tool directory first and build clean to see if that fixes it.

Related

Error when running flutter pub run build_runner build --delete-conflicting-outputs

I'm trying to integrate a smart contract into my flutter and I'm referring to this example. I have included all the dependencies and dev_dependencies in the first step and I'm stuck in the second step where this error occurs where the system could not find the path to builders.dart in the web3dart package.
After updating Flutter to version 2.5.2, there were some conflicts even though no code was changed, therefore I use any in pubspec.yaml.
dependencies:
flutter:
sdk: flutter
moor: ^4.5.0
provider: ^5.0.0
path_provider: any
path: ^1.8.0
dev_dependencies:
flutter_test:
sdk: flutter
moor_generator: any
build_runner: any
flutter_launcher_icons: any
For me, I had to downgrade to web3dart: ^2.3.5 from ^2.4.1 (pubspec.yaml)
Ran flutter pub get
But the web3dart-2.4.1 folder remained in .../flutter/.pub-cache/hosted/pub.dartlang.org/
The problem was that build_runner was still looking in the 2.4.1 folder
So I removed everything from the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.4.1 folder and moved everything from the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.3.5 folder into the .../flutter/.pub-cache/hosted/pub.dartlang.org/web3dart-2.4.1 folder
Closed Android Studio
Reopened it and ran flutter pub run build_runner build
And it worked
CAUTION: DO NOT RUN FLUTTER PUB UPDATE BEFORE RUNNING FLUTTER PUB RUN BUILD_RUNNER BUILD
When I ran flutter pub update, it pulled a completed different web3dart version (2.4.0) into .../pub.dartlang.org/, which has the same bug in it.
Your folder version may be different, but if you can get the web3dart-2.3.5 version and find which folder build_runner is looking in (by running it in Terminal and reading the error message), you can put the good code into there and it should work

Issue with the installation of flutter_launcher_icons

I added the flutter package "flutter_launcher_icons" but get problems when try to use it.
My "pubspec.yaml":
environment:
sdk: ">=2.13.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_blue: ^0.8.0
csv: ^5.0.0
share: ^2.0.4
path_provider: ^2.0.2
flutter_launcher_icons: ^0.9.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/Logo.png"
adaptive_icon_background: "assets/launcher/background.png"
adaptive_icon_foreground: "assets/launcher/foreground.png"
When I run "pub get" I get this (looks OK):
C:\src\flutter\bin\flutter.bat --no-color pub get
Running "flutter pub get" in ble_thms... 790ms
Process finished with exit code 0
But when I try to run the "flutter_launcher_icons" I get this:
C:\src\flutter\packages\flutter_tools>flutter pub run flutter_launcher_icons:main
Could not find package "flutter_launcher_icons". Did you forget to add a dependency?
pub finished with exit code 65
When I try to install "flutter_launcher_icons via terminal its the same:
C:\src\flutter\packages\flutter_tools>flutter pub get flutter_launcher_icons
Running "flutter pub get" in .... 894ms
C:\src\flutter\packages\flutter_tools>flutter pub run flutter_launcher_icons:main
Could not find package "flutter_launcher_icons". Did you forget to add a dependency?
pub finished with exit code 65
How can I solve this problem to use the package "flutter_launcerh_icons"? I also already tried "pub upgrade" and "pub outdated".
add the dependency **flutter_launcher_icons** like so:
flutter pub add flutter_launcher_icons
then:
flutter pub run flutter_launcher_icons:main
Hope this helps anyone with the same issues in the future.
The dependency is dev dependency, so it must go under dev_dependencies list.
dev_dependencies:
flutter_launcher_icons: "^0.9.0"
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/icon.png"
Dev dependency are not necessarily ran on "flutter run", but rather with specific command, like:
flutter pub run flutter_launcher_icons:main -f "pubspec.yaml'
Please refer to installation guide on pub.dev
You should be try to use below dependency:
flutter_launcher_icons: ^0.8.0
Below is your pubspec.yaml file:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.8.0"
flutter_icons:
image_path: "assets/icon/Logo.png"
android: true
ios: true
Prepare an app icon for the specified path. e.g. icon/icon.png
Execute command on the terminal to Create app icons:
flutter pub get
flutter pub run flutter_launcher_icons:main
OK, it seems that there is a problem with the flutter_tools and the dependence on "image"
C:\src\flutter\packages\flutter_tools>flutter pub add flutter_launcher_icons
The current Dart SDK version is 2.13.4.
Because flutter_launcher_icons <0.4.0 requires SDK version >=1.20.1 <2.0.0 and flutter_launcher_icons >=0.4.0 <0.7.1 depends on image ^2.0.0, flutter_launcher_icons <0.7.1 requires image ^2.0.0.
And because flutter_launcher_icons >=0.7.1 <0.9.0 depends on yaml ^2.1.15 and flutter_launcher_icons >=0.9.0 depends on args 2.0.0, every version of flutter_launcher_icons requires args 2.0.0 or image ^2.0.0 or yaml ^2.1.15.
And because flutter_tools depends on both args 2.1.0 and yaml 3.1.0, every version of flutter_launcher_icons requires image ^2.0.0.
So, because flutter_tools depends on both image ^3.0.2 and flutter_launcher_icons any, version solving failed.
Can I "downgrade" somehow the "flutter_tools" ?
Found the problem:
I somehow changed the path in the Android Studio Console to "C:\src\flutter\packages\flutter_tools".
So I changed it back to the project path "C:\src\Android\AndroidStudioProjects\my_flutter_project".
Now it is working.
Clumsy mistake from my side. :-(
This is how I solved my problem, type this command in the code editor terminal:
flutter pub add package_name
or, if it already exist:
flutter pub upgrade package_name
Hopefully it will solve the problem
I got the same error and i find that i wrote laucher instead of launcher in my command line
I just solved the same error you have, and it was something so simple that many of us do not realize it sometimes.
Verify that the terminal is in your project folder.
Try putting flutter_launcher_icons: any in the dev_dependencies: section like in the image.
Verify correct indentation in pubspec.yaml
click to see image
I had the same problem,
flutter clean
then
flutter pub get
solved it.

How to solve multi dependency version conflicts simply?

I have imported a project in android studio flutter. But, there is an incredible amount of version conflict coming in. If one solves other rises and if that goes down, other one rises. I am trying to get all packages and it is showing me the following error as below.
Because date_utils >=0.1.0+3 depends on intl ^0.16.0 and prokit_flutter depends on intl 0.17.0-nullsafety.2, date_utils >=0.1.0+3 is forbidden.
So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.
pub get failed (1; So, because prokit_flutter depends on date_utils ^0.1.0+3, version solving failed.)
Process finished with exit code 1
And my pubspec.yaml code is as below.
name: prokit_flutter
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
url_launcher: 5.0.3
nb_utils: 3.1.6+7
google_fonts: 1.1.0
animations: 1.1.2
intl: 0.17.0-nullsafety.2
http: 0.12.2
firebase_core: 0.5.0
firebase_analytics: 6.0.0
firebase_crashlytics: 0.1.4+1
google_sign_in: 4.5.3
html: 0.14.0+3
share: 0.6.5
mobx: ^1.2.1+2
flutter_mobx: ^1.1.0+2
flutter_statusbarcolor: 0.2.3
simple_animations: 1.3.8
snaplist: 0.1.8
flutter_svg: 0.18.1
flutter_slidable: 0.5.7
flutter_staggered_grid_view: 0.3.2
flutter_staggered_animations: 0.1.2
geolocator: 5.3.2+2
geocoder: 0.2.1
google_maps_flutter: 0.5.21+3
clustering_google_maps: 0.1.2
razorpay_flutter: 1.2.2
signature: 3.2.0
liquid_swipe: 1.5.0
lipsum: 1.0.1
flutter_colorpicker: 0.3.4
clippy_flutter: 1.1.1
flutter_tags: ^0.4.8
image_picker_gallery_camera: 0.1.6
video_player: 0.10.11+2
charts_flutter: ^0.9.0
like_button: ^1.0.1
flutter_reaction_button: ^1.0.1
lottie: ^0.6.0
showcaseview: ^0.1.6
date_utils: ^0.1.0+3
cached_network_image: ^2.3.1
flutter_localizations:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
mobx_codegen:
build_runner: ^1.9.0
#flutter packages pub run build_runner build
flutter:
uses-material-design: true
assets:
- images/smartDeck/images/
fonts:
- family: Andina
fonts:
- asset: fonts/andina.ttf
And there are 4-5 dependency version error. How can I solve this version error thing in one click or I can just somehow skip this version problem and get the thing done. Please help, Thanks in Advance.
Whenever conflicts between dependencies occur, the simplest solution is to just remove the version number of both that dependencies and type 'any' without quotes in front of them.
for example let's say this following two dependency conflicts:
shared_preferences: ^0.5.7+3
requests: ^3.3.0
then do following:
shared_preferences: any
requests: any
After this do pub get and issue will be resolved. Now, most importantly, don't leave any dependency on this form. instead goto pubspec.lock file and search these two dependencies. Flutter itself chooses the versions that don't conflict, copy those and replace it to pubsec.yaml
You can use dependency_overrides in your pubspec.yaml to force a specific package version. The package version will override any reference to a dependency in the entire app.
In your case you could use
dependencies:
flutter:
sdk: flutter
...
cupertino_icons: ^1.0.0
dependency_overrides:
intl: ^0.17.0-nullsafety.2
See dependency_overrides for more information.
Replace intl: 0.17.0-nullsafety.2 version with intl: 0.16.1 and remove intl from dependency overrides.
Now, run pub get command.
You can simply change the version of package that is causing conflic with another version which is compatible with your dart SDK. I tried it and the problem was solved.
had the same problem; ran the following command:
flutter pub upgrade --major-versions
if you don't mind having the latest version of all the dependencies while solving version conflict issues, this should be a quick fix.
I had this problem after resetting my Mac mini.
If you still have the pubspec.lock file at the last successful run (or get it from another dev, on that dev's computer the project is still running).
flutter clean.
Replace pubspec.lock by the old one.
Run the project again.

analysis_options.yaml the included file not found

I have a flutter package that uses effective_dart which is working as expected.
(I've explicitly tested this by adding/removing the include and ensure that warnings come and go as expected.)
I have the effective_dart dependency in my pubspec.yaml as follows:
name: sounds
version: 0.9.1
repository: https://github.com/bsutton/sounds
homepage: https://github.com/bsutton/sounds
documentation: https://github.com/bsutton/sounds/wiki
description: Sounds provide a complete api and Widgets for audio playback and recording. Both iOS and Android are supported.
environment:
sdk: '>=2.1.0 <3.0.0'
flutter: '>=1.17.0 <2.0.0'
dependencies:
device_info: '>=0.4.2+4 <2.0.0'
flutter_spinkit: ^4.0.0
meta: ^1.1.8
path: ^1.6.4
path_provider: ^1.6.7
provider: ^4.1.0
sounds_common: ^1.0.1
uuid: ^2.0.4
flutter:
sdk: flutter
dev_dependencies:
pedantic: ^1.9.0
effective_dart: ^1.2.1
dshell: ^1.0.0
e2e: ^0.5.0
lint: ^1.1.1
pub_semver: ^1.4.4
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
flutter:
plugin:
platforms:
android:
package: com.bsutton.sounds
pluginClass: Sounds
ios:
pluginClass: Sounds
The analysis_options.yaml contains:
include: package:effective_dart/analysis_options.yaml
analyzer:
errors:
todo: ignore
strong-mode:
implicit-casts: false
implicit-dynamic: false
The problem is that I keep getting a warning about the include not being found.
If I make a trivial edit (add a commented out blank line) to the analysis_options.yaml file the error goes away for a while but invariably returns (generally after a restart of the ide).
I'm using vs code but believe I've seen it in android studio (although I can't reproduce it now).
The error:
The include file package:effective_dart/analysis_options.yaml in /home/bsutton/git/sounds/analysis_options.yaml cannot be found.
The problem is having no material impact on my project but its just really annoying to have a warning always showing up.
Using the command given below is worked for me. Let you try it in the terminal.
flutter pub add --dev flutter_lints
(restart VSCode if the warning is still shown)
This seems to be a problem with sub projects (your example folder). See https://github.com/dart-lang/sdk/issues/42910
You can try to exclude the example in your root analysis_options.yaml:
analyzer:
exclude:
# workaround for https://github.com/dart-lang/sdk/issues/42910
- 'example/**'
And then add a separate analysis_options.yaml to the example.
If someone is still looking for the answer for the same error, this worked for me.
I have added flutter_lints: ^1.0.4 in dependencies in pubspec.yml file.
And the error gone.
you can try this command
flutter pub add --dev flutter_lints
if didn't work use this command
flutter pub upgrade flutter_lints
It show's up cuz the project import the flutter lints (as it says to encourage good coding practices). Usually, there's a hashtag in front of it that makes it functionless. When there was no hashtag, it was activated and found for the flutter lints package.
Solution:
Add hashtag # in front of it.
Add flutter_lints: ^1.0.4 package in pubspec.yaml file.

Running angular_components with Dart SDK 2.1.0-dev

I have installed the latest Dart SDK 2.1.0-dev.7.1 to try out Material design examples:
https://github.com/dart-lang/angular_components/tree/master/examples
The sample that fails in the following is:
angular_components/examples/material_card_example
I have git cloned the repo and when running webdev serve in one of the samples I get:
webdev could not run for this project.
You must have a dependency on `build_runner` in `pubspec.yaml`.
# pubspec.yaml
dev_dependencies:
build_runner: >=0.8.10 <2.0.0
You must have a dependency on `build_web_compilers` in `pubspec.yaml`.
# pubspec.yaml
dev_dependencies:
build_web_compilers: >=0.3.6 <0.5.0
Do you know how to run the samples?