When publishing a pub package, the docs say to run the following command:
flutter pub publish --dry-run
However, this is giving the following error:
Could not find an option named "dry-run".
Run 'flutter -h' (or 'flutter -h') for available flutter
commands and options.
How do I run a "dry-run"?
This is a self-answer Q&A after finding the answer. The answer is below.
Use:
flutter pub pub publish --dry-run
Thanks to this post for the solution.
Related
Ever since null-safety was introduced to Flutter, when I do flutter clean, the whole project switches to null-safety.
I can not update my whole project to null-safety quite yet as many packages I use have not migrated.
How can I do a flutter clean without getting thousands of errors telling me that non-nullable item must be initialized first...
I am currently on Flutter 1.24.0-10.2-pre, channel beta.
pubspec.yaml includes the following
environment:
sdk: ">=2.2.2 <3.0.0"
I get exactly the same issue. I haven't found a fix yet but if you open the pub spec.yaml file and save it without making changes it solves the issue until you next run flutter clean.
I have the same issue. For me running flutter pub get worked. But I still don't know why this error happens
Using VS code editor:
Go to terminal
Execute flutter pub get
The above fixed similar issue I got
I have the same problem, For me
Go To 'Terminal'
Type 'flutter pub get'
That is!!
I am using VS code.
Sometimes you have to run this command:
dart pub upgrade
or
dart pub update
If you get an error after running "flutter clean", do the following to solve the problem;
Go to your terminal
Run this command: "flutter pub get"
After this you'll see "Running 'flutter pub get' in 'xxx'(where xxx stands for the name of your project)
When this is complete, all will be reset back to normal
I am trying to get all versions of Flutter using command line directly -as always- but it is not working anymore.
Command:
flutter version
Result:
Could not find a command named "version".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Is there any alternative for it rather than opening the website?
As the flutter version on my Flutter 1.22.4 installation says:
[!] The "version" command is deprecated and will be removed in a future version of
Flutter. See https://flutter.dev/docs/development/tools/sdk/releases for previous
releases of Flutter.
Here is the Pull Request that removed this deprecated command.
Here is the corresponding issue.
I wanted to create a flutter project with androidx enabled by command.
but I founded this. I upgrade flutter but not working
$ flutter create --androidx hello_world
Could not find an option named "androidx".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
To create a new project run:
flutter create -t <project-type> <new-project-path>
Ref:
https://flutter.dev/docs/development/androidx-migration
I have a Flutter project and I have run it, everything is fine for a moment. But after some run, an error occurred. I cannot run my flutter project again, this is the error message
Could not find an option named "dart-define".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
How to fix this error? Thanks!
I have found the problems, I accidentally rename my Flutter SDK to "flutter ". So I just rename my Flutter SDK back to "flutter" and restart my Android Studio.
Briefly: Can anyone tell me how to know if the dart code has been invoked or how to mark it as hits and misses.
We can get test coverage by 'flutter test --coverage'. But this rely on test.dart file, I mean we have to write test.dart file for the file and function we care about. If we can collect the coverage info when dart is running, it will be easier for us to know which code lines has been invoked. And I think it will be friendly for developers.
I have searched dart-lang/sdk, only know that 'flutter test --coverage' gets reports by invokeRpcRaw('getSourceReport'...), but I have no idea how to get reports for dart runtime.
If runtime dose not work, can I do something when compile?
On Mac
brew install lcov
Or use ubuntu or windows alternatives for this
then
flutter test --coverage
genhtml coverage/icov.info -o coverage/html
open coverage/html
https://github.com/dart-lang/coverage may help you
flutter pub global activate coverage
flutter run (you can use -d to select device)
flutter pub global run coverage:collect_coverage --uri=http://... -o coverage.json --resume-isolates
flutter pub global run coverage:format_coverage --packages=./.packages --report-on lib --in coverage.json --out lcov.info --lcov
I have try this and finally get the lcov.info in runtime, good luck