I just upgraded Android Studio and saw flutter packages get changed to flutter pub get in "Tools > Flutter".
Does this have any change in the functionality? Or are they completely the same?
They both do the same thing. To prove this I created two exact same new projects and added exact dependencies
dependencies:
image_picker: ^0.6.4
Now in one of the project I ran the command flutter pub get and in another one flutter packages get , both of them in verbose mode to check what is happening behind the scenes.
I could see logically no difference at all except those time taken to execute(which doesn't matter). The rest of the contents in the file as exactly the same.
So yes, they are doing the same thing
They are the same.
flutter packages used to support only two subcommands including flutter packages get, but more commands were added later on.
And then, flutter packages was renamed to flutter pub. The former is now just an alias for the latter.
flutter packages get was not affected by the first change as it had already existed at that point, and its functionality has not been affected by the second change either as it was just a rename.
The pub command is specific to dart and is a set of tools for managing dart packages. You can get an explanation about it and its usage here.
pub get is shorthand for the pub get packages which is how packages are downloaded in dart projects. Adding the flutter keyword before it makes it so that the command is run by the flutter SDK, which will map it to the sdk's packages get command. Reference
As for using the two, they can be used interchangeably as the Flutter SDK will automatically change flutter pub get to flutter packages get inside flutter projects, and I imagine the change in Android studio is semantic in nature to make it more inline with typical dart style as dart developers will be used to running pub get.
When "flutter packages get" is executed, you will see
Running "flutter pub get" in xxx...
The two commands achieve the same results.
these both commands act as same, when we run flutter packages get it actually run the command flutter pub get
We can say flutter packages get is just syntactic sugar over flutter pub get
Related
unfortunately this question was closed however it is spot on. Let me go through the steps as I am reproducing a legacy app issue that uses httpclient so switching is not an option YET (6 months out maybe).
create android studio app
try to use Httpclient and as he shows in the post above it is in red
I try to add this line in build.gradle to bring it in as a work around(even though core android also brings it in)
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
Then I get this error in android studio
`httpclient` defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for `httpclient` use `HttpUrlConnection` or `okhttp` instead), or repackaging the library using something like `jarjar`.
Ok, so I am using the wrong version so I run build scan and I see this so I bring this one in instead of the other version (android studio now sees HttpClient and can import it at this point)
I still get the same error though about conflicting android libs.
QUESTION: How do I fix the red in my legacy project and not have this error either?
My best bet seems to ignore the error. Will I have issues that I am not seeing though in the future?
I need to have Flutter set to the Beta channel (Flutter 1.25.0-8.3.pre at the time of writing) but not to "opt in" into the null safety feature, which is why I'm manually setting the Dart version to the Stable channel.
As I'm using Intellij IDE, I've tried defining the Dart SDK path in Settings but once I change that to the path of a stable version (which I seperately setup in standalone location) flutter run no longer works through the IDE. Just running flutter run in a terminal works.
Just to shed more light on the matter. It seems that once I change Dart SDK path in settings the Flutter SDK path is being unset and vice versa.
side note: I need flutter beta because of its support for web
switch to beta channel
flutter channel beta
update to latest version
flutter upgrade
dart-sdk comes with flutter, location is:
flutter/bin/cache/dart-sdk
set this for dart-sdk path in intellij-idea
then in pubspec.yaml you can define the dart version you want for current project
i am using this version for non-null safety projects:
environment:
sdk: ">=2.9.0 <3.0.0"
this version for null safety projects:
environment:
sdk: '>=2.12.0-29.10.beta <3.0.0'
note: i am on dev 1.26, my newest project is running null safety feature but older projects are on non null safety because they are already in production and i dont want to migrate them. Everything works fine
You can read more about Flutter channels in Official Documentation.
this might be a quick one.
I've imported a Flutter project which a colleague created via VS Code into Android Studio (via Git - Bitbucket).
(I've worked on another new Flutter project just this day.)
The problem is: some icons he used aren't found by the compiler for me.
Examples of working icons:
Icons.pregnant_woman
Icons.person
Icons.calendar_today
Not working:
Icons.qr_code
Icons.biotech
Also, no matter in which file I'm in, there's a hint window above stating: 'Pub get' has not been run and I get the option to run get dependencies (pub get) or upgrade dependencies (pub upgrade).
When I first imported the project, the compiler didn't even know what Flutter is. After I executed pub get the first time, most of the errors were gone. The only ones missing are the few icons. But the hint saying I didn't do pub get is still there which was never like this in my other projects.
What can I do?
Btw, pub outdated says dev_dependencies: all up-to-date and
Dependencies are all on the latest resolvable versions.
Newer versions, while available, are not mutually compatible.
I run into this problem a while ago. The way I managed to solve it is:
go to Vs code setting and search flutter create and disable Flutter Create Offline
I hope this is helpful!
Got it! Turns out I changed some internal flutter file some while back and it wouldn't upgrade the flutter version automatically until I did "flutter upgrade -force".
I am building cross-platform with Flutter using Android Studio.
During my development process, I would like to use development tools like
Flutter Redux Dev Tool which shows a debug screen right on the application UI like this
Or I can have my own debugging modules in the form of custom-styled print statements which I insert into different places in my codes.
I don't want to have to comment these debugging code out and/or switching out the appropriate UIs every time I need to build a product version
Are there ways to do this?
PS: I heard about build variants on Android Studio, is this the industrial way to solve this? If so, how to use it with Flutter
One way is to use different entry-point files
flutter run -t lib/main_config1.dart
flutter build apk -t lib/main_config1.dart
...
You can then configure your application with different services (for logging or similar) depending on the requirements.
The --flavor options provides further ways for customization.
See also https://medium.com/#salvatoregiordanoo/flavoring-flutter-392aaa875f36
Maybe this question has been done before but I can not find anything.
I would like to know what steps to follow so that Visual Studio Code can show the autocomplete window that shows Rust methods and such, for example when using ctrl+space (In many commons, editors) What I see is that it works for std but not for gtk-rs.
I was wondering if I would have to tell you in some way how to find the files or something like that.
I do not know if this will depend on each editor or all have some specific files included, my IDE is Visual Studio Code.
...you forgot to include the extensions that you have installed
kalitaalexey
Rust for Visual Studio Code
Rust Language Server integration.
Autocompletion (via racer or RLS).
Go To Definition (via racer or RLS).
Go To Symbol (via rustsym or RLS).
Code formatting (via rustfmt).
Code Snippets.
//..
Although there could be many possible causes of a problem with the Rust extension in Visual Studio Code, the following steps should help anyone with issues of this kind:
Do not use the old extension "Rusty Code", since it's no longer maintained. Instead, you have two options:
rust-analyzer provides by far the best Rust language support and is already part of the Rust organization. This is the recommended choice today.
rust-lang.rust is an older extension developed by an official Rust team and is focused on Rust Language Server (RLS) integration. It is not as powerful.
The kalitaalexey.vscode-rust extension was forked from Rusty Code to make it more stable, but that one too eventually lost maintenance.
When using RLS, you might need to build your project so that dependencies are downloaded and compiled locally, thus enabling the extension to retrieve additional information about them.
It's always worth making sure that the extension is up to date and properly configured. Update the extension, and check out the respective documentation for instructions on how to make it work.
Check the status bar. If something is wrong, it should tell you so. Open the extension task's output window for error messages. If something still isn't right, try reloading your window.
If there's still a problem after these steps, it might actually be a bug, which should be reported.
For me solution was to use Rust Analyzer extension https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer instead of rust-lang.rust https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
If you're just starting with Rust and VSCode, and want to enable autocomplete, this is what I did (Novemeber 2021):
Install Rust extension in VSCode
Open root folder of you existing Rust project(or create new) in VSCode (and select "trust workspace" if asked)
Open src/main.rs, now in lower right corner VSCode will ask you to install some components, click yes and it will install both Rust Language Server and Rust Analyzer
Autocomplete should now work with CTRL+SPACE
Before trying out E_net4's solutions, make sure you are running your Rust project from root. (same directory as Cargo.toml)
I was running :
-app
- src
- Cargo.toml
-app2
- src
- Cargo.toml
As my workspace root.
For me, the answer was to install rust via rustup rather than through Home Brew.
Install rust via Rustup
Install the rust-analyzer extension
Also ensure that the workspace is trusted in VS Code.