Dart / Flutter Install Help Needed Please

Hi Clear Community.

Please can someone advise how to install dart & flutter on clear linux. I am new to clear linux and it flatpak sandbox and i would like to know how to go about installing the software as well as VS Code outside the flatpak sandbox.

Thanks in Advance.
Ebrahim.

The Dart SDK is bundled with Flutter; it is not necessary to install Dart separately.

mkdir flutter
cd flutter

wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz

tar xf flutter_linux_v1.7.8+hotfix.4-stable.tar.xz

Add the flutter tool to your path:

export PATH="$PATH:`pwd`/flutter/bin"

This command sets your PATH variable for the current terminal window only.

To make it permanent, set

export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"

Check path with :

echo $PATH

Verify that the flutter command is available by running:

which flutter

Type :

flutter precache

Let us know how it worked out !

3 Likes

Flutter SDK
To set up flutter you need to install a gzip binary as clear uses pigz as an alias for this which causes issues with the pub command due to the streaming requirement.
To work around this issue I simply grabbed the http://ftp.gnu.org/gnu/gzip/gzip-1.10.tar.gz source and built it via the usual ./configure and make commands (NOTE no need to make install) simply grab the gzip binary and put it somewhere “common” I moved it to my $HOME/.bin folder. Then throw this dir in front of your current path (export PATH=$HOME/.bin:$PATH) Then you should be able to simply git clone https://github.com/flutter/flutter.git (or download as per steps 1 & 2 of the install instructions) and follow step 3+ of the instructions at https://flutter.dev/docs/get-started/install/linux.

Android SDK
To start with I installed: kvm-host, java-basic as java 8 and kvm are required to run the sdk tools & emulator. (dont forget to add yourself to the kvm group!)
Now this is where it gets hairy… (TLDR don’t install your IDE using flatpak as it looks like is your desire - smart! but im not sure how to install vscode but it looks as though they provide a deb, rpm and tar.gz option so I imagine unzipping the tgz version might be all you need)

As I mostly do java work, I naviely installed Intellij IDEA through the package manager (this is then installed via flatpak much like vscode I imagine).
With the android plugin this made installing the android SDK a breeze but alas 2 issues had to be tracked down.
a) ‘/dev/kvm’ was being reported as not available preventing me from starting (but not creating) an android device image. To rectify this I need to update the applications .desktop file as such:

bjc@bjc-xps~ $ cat .local/share/flatpak/exports/share/applications/com.jetbrains.IntelliJ-IDEA-Community.desktop 
[Desktop Entry]
Categories=Development;IDE;
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --device=kvm --command=idea com.jetbrains.IntelliJ-IDEA-Community
GenericName=Capable and Ergonomic Java IDE
Icon=com.jetbrains.IntelliJ-IDEA-Community
Keywords=development;idea;intellij;java;
Name=IntelliJ IDEA Community
StartupNotify=true
StartupWMClass=jetbrains-idea-ce
Terminal=false
Type=Application
X-Flatpak=com.jetbrains.IntelliJ-IDEA-Community```

Specifically I added the --device=kvm option.

b) Because Intellij was installed using flatpak (and now comes with java 11) I needed to install the ‘openjdk 8 sdk extension’ (this might be intellij specific) also note there are 2 of them with the same name and only 1 of them seems to expose the sdk correctly to intellji at /usr/lib/sdk/openjdk8/jvm/java-8-openjdk). Now the down side to this is that the certificate stores are not correctly exposed via flatpak (h ttps://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk10/issues/4).

So I had to seed my projects outside of intellij (simply running ./gradlew build) in the ‘android’ dir of a flutter project will downloaded gradle & required dependencies which avoids the java ssl issues from intellij.

From here I was able to develop/debug my flutter app from within intellj.

Hope this helps or at least can be amended for vscode.

2 Likes

Thanks so much guys(Businux and Bjc) . I will try this out on my Clear VM and let you know how it went…Cheers Buddy.

1 Like

Hi guys… I have had trouble getting it to work…i have intellij installed but the config doesn’t save as it can’t create the desktop config… And also I managed to install Gradle, Maven and Java 11 with SDKman… Now I am having trouble opening the file explorer nautilus by default without running the command… And flutter has been giving trouble too so I deleted it. . Will re-install it using SDKman and please can you advise the directory of SDKman and it’s installed packages directory on clear linux… I am using the root account and cannot find it as easily as how ubuntu users find it.

Thank You so much for your help.