How can i change my dart-sdk on VSCode - sdk

i have been using flutter recently and i really wanted to use Jaguar for my project. But here is the catch, the flutter sdk brought dart with version 2.0.0-dev-58.0 but jaguar said they need dart sdk with version 2.0.0-dev-65.0
Okay, so i get myself dart with sdk version of 2.1.0-dev.1.0, but my vscode can't seem to recognize that i have installed the sdk.
Any ideas on how to change that?

The Dart Code plugin has a setting dart.sdkPath
The location of the Dart SDK to use for analyzing and executing code.
If blank, Dart Code will attempt to find it from the PATH environment
variable. When editing a Flutter project, the version of Dart included
in the Flutter SDK is used in preference.
There's also dart.sdkPaths which allows quick switching between alternatives.
For Flutter projects, use dart.flutterSdkPath(s)

It's quite easy if you use VSCode:
Clone flutter repo to a new folder:
mkdir ~/flutter_dev
cd ~/flutter_dev
git clone https://github.com/flutter/flutter.git .
Open your workspace preferences and update dart.flutterSdkPath setting:
"settings": {
"dart.flutterSdkPath": "/Users/youruser/flutter_dev"
}
Restart VSCode and you're good to go.
See more info in Dart Code - Quickly Switching Between SDK Versions

I want to add one more things to #Andrey, you can use FVM to install as much as you want versions and channels, it's easy to install and manage versions. It hold all versions on your home directory, I think it's easier than managing with Git.

Related

Connecting IOS firebase app to my flutter app

I am trying to connect a IOS Firebase app to my flutter and the packages I am importing come up with the error "The library 'package:firebase_auth_web/firebase_auth_web.dart' is legacy, and should not be imported into a null safe library.
Try migrating the imported library".
There is more than one problem as per your description and comments.
The easiest solution is to upgrade the dart, flutter, and all the dependencies you are using because it seems that you are using all the things which are older.
First, in your command prompt (terminal), run:
> flutter upgrade
This will upgrade your flutter and dart both. Secondly, run:
> flutter pub upgrade
This will upgrade all the dependencies. Finally, run:
> flutter pub upgrade --major-version
This will also upgrade all the dependencies.
Doing these will make your application up to date with the dependencies. Now, try to run the app again. Most probably it will work, if it doesn't then it might tell you to upgrade your compileSdkVersion in build.gradle to something larger number. If so, upgrade that number in your app>build.gradle file.

How can I fix "Checking Dart SDK version... << was unexpected at this time" error in Flutter?

I am facing an issue any time I try to run any app or flutter command from the terminal, this is displayed: Checking Dart SDK version... << was unexpected at this time.
Not even flutter doctor works.
Nothing seems to work and it's so frustrating as it happened out of the blue. One moment everything was fine, now nothing works. Any help will be appreciated
I've resolved this error with the below steps:
Go to C:\Users\{Name}\.gradle} - Delete the .gradle directory.
Then Download and install the same flutter and dart SDK version in some other location and set the environment variables.
Example:
Environment variables Before :
("D:\FlutterExtractedFiles\flutter\bin")
("D:\FlutterExtractedFiles\flutter\bin\cache\dart-sdk\bin")`
Environment variables After :
("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin")
("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin\cache\dart-sdk\bin")
Then check the Android Studio event log
I've resolved this error by following these steps:
Go to folder C:....\Flutter\
Run this command: git reset --hard HEAD
This will restore the flutter SDK folder to its original state, so no need to reinstall the SDK.
Flutter reinstalled worked for me..
delete flutter folder in C directroy.
make a src folder in C: directory.
GoTo cmd and install flutter from official flutter github repoC:\src>git clone https://github.com/flutter/flutter.git -b stable
https://flutter.dev/docs/get-started/install/windows
run flutter doctor
set env path.
DONE
What worked in my case was deleting the .gradle file (C:\Users\USER.gradle) and reinstalling Flutter in another location and changing the PATH to it.
you should try this
restart your pc and delete the flutter folder in C directory then reinstall flutter and run flutter doctor
For me, the following steps resolved the problem:
Open cmd and run flutter doctor. (if there is an issue resolve them first.)
If not then change the flutter channel to dev. Whatever your channel is?. If this is the dev channel then change to master channel.
Again flutter doctor. If everything goes perfectly. then run your project. If it runs accordingly then again change to channel to stable.
I faced this error before, all I had to do was to:
Remove Flutter from my C directory.
Install Flutter from the official website.
Run Flutter doctor: flutter doctor
No need for changing the PATH or any further actions.
If it worked fine with you then you are all done!
I faced another error after it, related to the Dart SDK and solved it using this link
the key is to install Android SDK Command-line Tools, steps being:
Open Android Studio Tools Menu, SDK Manager In the window that comes
up there are inner panels, choose SDK Tools panel Tick Android SDK
Command-line Tools Choose Apply button near the bottom of the window
At that point, you will be prompted to accept the SDK license and the
command line tools will be installed. Your license issue should now be
resolved.
If your using Intelij and get the << error and none of the above work.
Delete the .intelij folder in your project and reopen the folder in intelij.
I faced this problem too and I've solved it by downloading SDK file again.

Build flutter app for desktops

I saw a few peoples managed to build flutter apps for other OS than the usual Android/IOS
My question here is simple : How ? What is the current process to build a flutter app for mac/windows ? There's no need for it to be production ready. Something experimental is enough
For those wondering how to :
https://github.com/google/flutter-desktop-embedding
There's an example using openGL to render a flutter app
Run a Flutter project in Desktop
Step 1:
For Flutter to run on Desktop, we must be on the master channel, with the latest release. So run from cmd,
flutter channel master
and
flutter upgrade
Step 2:
Then we have to enable flutter desktop support.
set ENABLE_FLUTTER_DESKTOP=true
Step 3:
Then clone this repo and cd example directory.
Step 4:
Then replace the lib folder inside the example directory with our existing code, and replace the pubspec.yaml file, with our existing one.
Step 5:
Then run from terminal
flutter packages get
and
flutter run
You can find more info here.
You can check this link out
https://github.com/google/flutter-desktop-embedding
Still not stable but does a good job of rendering flutter apps on desktop
Here's something I found useful, it is currently in alpha version but does the job by enabling us to develop Mac and Windows apps in Flutter :
https://feather-apps.com/
For those who want to know the current state(2021), here is the startup project to help you test It for MacOS, Linux, Windows. The project heavily modified from official ci to build cross-platform easily. You might want to check the ci.yml If you want to build on certain platform without github-action.
In additional, go-flutter is also a valid option, that used go-lang and openGL to achieve cross-platform features.
If you want to know the difference between official and go-flutter, here is the issue about the details.

PubNub - iOS - Carthage only?

Question for someone who's quite fresh with PubNub and iOS-Swift,
as of today can you put PubNub in a project, entirely, absolutely not using cocoapods in any way? So, pure Carthage?
(PubNub's own doco is a little confused on the matter, at a quick glance.)
(Strictly iOS 10, no legacy)
Docs looks pretty clear about how to use Carthage way of integration.
To run this command you don't need CocoaPods (platform can be any: macos, tvos, ios and watchos or w/o platform to build all):
carthage update --platform ios
The only thing is required is Cartfile at the same directory from which you will call command from above. It should contain at leas this line (depending from version which you need):
github "pubnub/objective-c" ~> 4.1
As result you will get .framework bundle under Carthage/Build/{platform-name}/PubNub.framework. As mentioned in docs you can drag&drop it into your project and don't forget to add it to Embedded Binaries.
It looks like the project builds standalone frameworks, so you could add it as a Carthage dependency.
Carthage just downloads the project and builds it according to the project settings. All the consuming project needs to do is add the specific built product to you project.

Dart docs say to set Flutter SDK path in Atom dartlang settings, but no such option exists

Under Getting Started > Getting Flutter at https://dart-atom.github.io/dartlang/:
"And from Atom, open the dartlang plugin’s preferences and set the Flutter SDK path to where the Flutter repo was cloned locally."
I have opened the settings for the dartlang plugin in Atom. There is no setting for Flutter SDK path. There is however a setting for Dart SDK Location. Is that the value that I should change to "where the flutter repo was cloned locally"? If not, where is the setting? Are the Dart docs wrong / in need of an update?
I should probably note that the Dartlang: Create Flutter Project command in Atom works even if this step is skipped. So I am more confused because I don't know if it's unnecessary, or I did something extra/right by accident, or this is expected but I'll run into issues later from not being able to update a setting that doesn't exist.
those instructions were updated slightly before the lastest version of the atom plugin was published; you should see the Flutter SDK field in the settings now.
The process for developing with Flutter did change a bit over the weekend. You'll probably want to:
pub global deactivate flutter
clone the flutter repo (see http://flutter.io/getting-started/)
set that Flutter SDK field in the atom plugin, and
add the flutter/bin location to your system path
That first deactivate step is to ensure that you don't have copies of the pub globally activated app on your path. The new workflow instead uses a 'flutter' shell script.

Resources