androidx command not found - flutter

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

Related

Gradle (Flutter) does not use the cache

I'm giving Flutter a try, I'm totally new.
I added gradle in:
[project_directory]/android/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=file:///run/media/me/gradle-7.2-all.zip
The first time I ran the flutter run command all dependencies were downloaded. But now when I create a new project, it downloads them again from the internet and doesn't use the previous cache. In fact, if I change something in pubspec.yaml, like adding assets, when I run flutter run it tries to download the internet dependencies again.
Am I missing any settings here?
Flutter 3.1.0 | Dart 2.18.0 | Gradle 7.2 | Linux
for .yaml run 'flutter pub get' command in terminal

error when i create flutter project from android studio

i installed all SDK and plugin
when i create flutter project, it alert error that is
error create project:
Could not find an option named "platforms". Run 'flutter -h' (or 'flutter -h') for available flutter commands and options.
and there is appear add configuration.
like this image
In android studio terminal type
flutter upgrade -f. After the upgrade, create a new flutter project.
More details here
Got this error as well, to fix I did the flutter upgrade -f, and upgraded my Android Studio to the latest version.

Could not find a command named "version" - Flutter

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.

Could not run Flutter project. Could not find an option named "dart-define"

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.

flutter pub publish: Could not find an option named "dry-run"

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.