when I try to "serve" my flutter web app
I'm getting this error:
This version of webdev does not support the build_daemon protocol
used by your version of build_runner. A newer version of webdev is
available which supports your version of the build_daemon. Please
update.
how do I update webdev ?
"pub global" seems to offer only "activate"/ "deactivate"
and "pub upgrade" is only looking into the pubspec.yaml file
any idea?
Oh... I just run "pub global deactivate " and then "pub global activate ".
Anyway I opened an issue on github suggesting to add the feature "update".
I hope this easy solution might help you,
feel free to follow up the issue.
Adding build_daemon: ^1.0.0 in dev_dependencies: of .yaml file fix my error
Do not use a global version, but use a per-project version.
To ensure running webdev on your project always works, include the version of webdev it requires in the pubspec.yaml file:
dev_dependencies:
webdev: ^2.7.9
...
And run it using:
$ dart run webdev ...
This ensures the correct version of webdev is installed when dart pub get is run, and that particular version is used for the project.
This avoids having to update the global version when things change. Running dart pub global deactivate webdev and dart pub global activate webdev is unnecessary work.
Globals are bad. Using "dart pub global activate ..." installs only one version of webdev, which may become out-of-date with your project (as you've discovered). Or you might have multiple Dart projects, and they require different versions of webdev. The above approach uses a per-project version of webdev, ensuring it is always the correct version for the project.
I got the same problem now when I followed this tutorial https://medium.com/flutter-community/flutter-create-and-deploy-a-website-from-scratch-4a026ebd6c, but I didn't get pass the error by running flutter pub global activate.
Here is what i configured in my computer
run: pub get
run: webdev serve
dev_dependencies:
build_daemon: ^1.0.0
build_runner: ^1.4.0
build_web_compilers: ^2.0.0
Wish this will fix your issues.
I had to use the following command to update webdev
flutter pub global run webdev deactivate
and then
flutter pub global run webdev activate
Related
When I run my bitbucket pipeline for my project im getting an error during flutter test:
/root/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'.
FirebaseAppPlatform.verifyExtends(_delegate);
^^^^^^^^^^^^^
When I run flutter test in my terminal I don't have these issues.
My pipeline script is:
Build Setup
flutter clean
flutter pub get
flutter pub run build_runner build
bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
flutter test
Because there are some breaking change of firebase_core_platform_interface that do not comply with semantic versioning:
https://github.com/firebase/flutterfire/issues/9806
You need to overwrite this library:
Root cause
You are update or installing only a subset of the Firebase plugins (firebase_core, firebase_analytics,...)
Solution
Solution 1: (preferred) Updating to the latest version with flutterfire update check the docs here. But it is not easily because your project will have a lot of packages dependencies to each other like flutter version 2 or 3, so on. Anyway, it is long term solution.
Solution 2: (Fix to run)
You can add to your pubspec.yaml
dependency_overrides:
firebase_core_platform_interface: 4.5.1
Solution 3: (Fix to run)
Update dependencies with this below command line:
flutter pub upgrade --major-versions
Finally, Run the project again by following stuffs:
flutter clean
flutter pub get
cd ios && rm -f Podfile.lock
cd ios && pod install --repo-update
flutter run
That's it!
Run "flutter pub upgrade --major-versions"
run this
flutter pub upgrade --major-versions
than run this
flutter upgrade
I changed my flutter version via flutter channel master. This changed automatically my pubspec.lock.
In my case, restoring previous version of pubspec.lock solved the problem (pug get needed).
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
Coming from npm, I deeply dislike the way Google handles package updates within Flutter. Instead of updating the pubspec.yaml on flutter pub upgrade, it will only update the pubspec.lock.
To ensure that the pubspec.yaml is up to date, I have to run flutter pub outdated and manually adjust the pubspec.yaml before running flutter pub upgrade. I'm too lazy for that, it's no fun, I want this to be automated. The recommend versions of flutter pub outdated should be set in the pubspec.yaml for me.
How to I do that?
you can use Ctrl+Space after a package name in pubspec.yaml to get the latest version.
you must press Ctrl+Space exactly one space after ' : ' to see the latest version.
cupertino_icons: <click Ctrl+Space here>
I'm currently developing flutter application with VSCode and want to add some packages. ex) dropdown_menu
I did flutter pub get / flutter packages get / clicking down arrow button in vscode(get Packages)
and this is all I get everytime
PS D:\VSCodeProjects\testt> flutter pub get
Running "flutter pub get" in testt... 0.4s
PS D:\VSCodeProjects\testt>
this is my code in pubspec.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
dropdown_menu: ^1.1.0
I did turn on / off program( and computer) , restart,
and
flutter clean
flutter packages get
flutter packages upgrade
Does anybody know how to solve??
It's running, by default in vs code whenever you save your .yaml file it runs it under the hood. When you explicitly run it using the command, it takes very less time as the packages are already up to date.
If in doubt, try to use the new packages that you added and they should not give errors.
flutter pub get is meant to be quick especially when you don't have much libraries.
What you see is right there should not be any problem.
But if there is issues where you are going for a specific version and it is not working, this is because pubspec.yaml stores the settings of what version of library but pubspec.lock stores the actual version your app is using.
Judging from your comments of it not showing up. It might be related to this #31115
try the solution and see if it works.
Select the View > Command Palette menubar option
Type "flutter"
Click "flutter get packages"
you can use this in vscode
Pubspec Assist
After typing the package don't forget to save the yaml file or click ctrl + s.
I just added the the fvm package to switch the flutter channel from stable to master without downloading sdk components every time when switching flutter channels.
I have followed the step written in readme.md for switching the channel.
I have set the following path in my environment variables.
D:\Program_Files\FlutterSDK\SDK\flutter\bin;
D:\Program_Files\FlutterSDK\SDK\dart-sdk\bin;
C:\Users\User\AppData\Roaming\Pub\Cache\bin;
Now, i have opened my first project in which i want to use "flutter SDK's master channel". But, whenever i try to use the command "fvm use master". It's not working.
It is giving me an error like,
'fvm' is not recognized as an internal or external command,
So, can anyone suggest a solution?
Thanks.
try :
pub global run fvm:main
pub global run fvm:main use VERSION
Hi adding in your path:
%LOCALAPPDATA%\Pub\Cache\bin
More info:
https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path
In my case fvm commands did not work on Windows even tho I checked everything. It gave missing fvm.exe file and other errors. If you also stuck there you can use this way. Only way I managed to get it work is to use longer commands like these:
flutter pub global run fvm:main list
Seems like all fvm commands:
config Set configuration for FVM
flutter Proxies Flutter Commands
install Installs Flutter SDK Version
list Lists installed Flutter SDK Version
releases Lists Flutter SDK releases.
remove Removes Flutter SDK Version
use Which Flutter SDK Version you would like to use
version Prints the currently-installed version of FVM
Works like this, you just need to add the fvm command to the ending of this - flutter pub global run fvm:main. So add any of them like this form:
flutter pub global run fvm:main releases
flutter pub global run fvm:main install 2.2.0
flutter pub global run fvm:main use 2.2.0
are you add "C:\flutter\bin\cache\dart-sdk\bin" to path?
if you in windows you should run your text editor as administrator as following
In my case Error Message was
Usage Error: Flutter version null is not installed
To fix this:
I have activated FVM by pub global activate fvm;
Printed installed fvm list by fvm list, it should give result as the image below:
Selected which Flutter SDK version to use by running fvm use 1.22.0 (in my case 1.22.0, it may differ according to your desired version) command, It will download SDK if it is not installed yet;
Now you can check is flutter running in your project by running flutter;
Also, you can check if the Flutter SDK version set by calling again fvm list.
The tick means, that version is running in your project.