Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Develop GUI apps using Flutter on Fedora

#1
Develop GUI apps using Flutter on Fedora

When it comes to app development frameworks, Flutter is the latest and greatest. Google seems to be planning to take over the entire GUI app development world with Flutter, starting with mobile devices, which are already perfectly supported. Flutter allows you to develop cross-platform GUI apps for multiple targets — mobile, web, and desktop — from a single codebase.

This post will go through how to install the Flutter SDK and tools on Fedora, as well as how to use them both for mobile development and web/desktop development.

Installing Flutter and Android SDKs on Fedora


To get started building apps with Flutter, you need to install

  • the Android SDK;
  • the Flutter SDK itself; and,
  • optionally, an IDE and its Flutter plugins.

Installing the Android SDK


Flutter requires the installation of the Android SDK with the entire Android Studio suite of tools. Google provides a tar.gz archive. The Android Studio executable can be found in the android-studio/bin directory and is called studio.sh. To run it, open a terminal, cd into the aforementioned directory, and then run:

$ ./studio.sh

Installing the Flutter SDK


Before you install Flutter you may want to consider what release channel you want to be on.

The stable channel is least likely to give you a headache if you just want to build a mobile app using mainstream Flutter features.

On the other hand, you may want to use the latest features, especially for desktop and web app development. In that case, you might be better off installing either the latest version of the beta or even the dev channel.

Either way, you can switch between channels after you install using the flutter channel command explained later in the article.

Head over to the official SDK archive page and download the latest installation bundle for the release channel most appropriate for your use case.

The installation bundle is simply a xz-compressed tarball (.tar.xz extension). You can extract it wherever you want, given that you add the flutter/bin subdirectory to the PATH environment variable.

Installing the IDE plugins


To install the plugin for Visual Studio Code, you need to search for Flutter in the Extensions tab. Installing it will also install the Dart plugin.

The same will happen when you install the plugin for Android Studio by opening the Settings, then the Plugins tab and installing the Flutter plugin.

Using the Flutter and Android CLI Tools on Fedora


Now that you’ve installed Flutter, here’s how to use the CLI tool.

Upgrading and Maintaining Your Flutter Installations


The flutter doctor command is used to check whether your installation and related tools are complete and don’t require any further action.

For example, the output you may get from flutter doctor right after installing on Fedora is:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Linux, locale it_IT.UTF-8) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) ✗ Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [!] Android Studio (version 3.5) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [!] Connected device ! No devices available ! Doctor found issues in 3 categories.

Of course the issue with the Android toolchain has to be resolved in order to build for Android. Run this command to accept the licenses:

$ flutter doctor --android-licenses

Use the flutter channel command to switch channels after installation. It’s just like switching branches on Git (and that’s actually what it does). You use it in the following way:

$ flutter channel <channel_name>

…where you’d replace <channel_name> with the release channel you want to switch to.

After doing that, or whenever you feel the need to do it, you need to update your installation. You might consider running this every once in a while or when a major update comes out if you follow Flutter news. Run this command:

$ flutter upgrade

Building for Mobile


You can build for Android very easily: the flutter build command supports it by default, and it allows you to build both APKs and newfangled app bundles.

All you need to do is to create a project with flutter create, which will generate some code for an example app and the necessary android and ios folders.

When you’re done coding you can either run:

  • flutter build apk or flutter build appbundle to generate the necessary app files to distribute, or
  • flutter run to run the app on a connected device or emulator directly.

When you run the app on a phone or emulator with flutter run, you can use the R button on the keyboard to use stateful hot reload. This feature updates what’s displayed on the phone or emulator to reflect the changes you’ve made to the code without requiring a full rebuild.

If you input a capital R character to the debug console, you trigger a hot restart. This restart doesn’t preserve state and is necessary for bigger changes to the app.

If you’re using a GUI IDE, you can trigger a hot reload using the bolt icon button and a hot restart with the typical refresh button.

Building for the Desktop


To build apps for the desktop on Fedora, use the flutter-desktop-embedding repository. The flutter create command doesn’t have templates for desktop Linux apps yet. That repository contains examples of desktop apps and files required to build on desktop, as well as examples of plugins for desktop apps.

To build or run apps for Linux, you also need to be on the master release channel and enable Linux desktop app development. To do this, run:

$ flutter config --enable-linux-desktop

After that, you can use flutter run to run the app on your development workstation directly, or run flutter build linux to build a binary file in the build/ directory.

If those commands don’t work, run this command in the project directory to generate the required files to build in the linux/ directory:

$ flutter create .

Building for the Web


Starting with Flutter 1.12, you can build Web apps using Flutter with the mainline codebase, without having to use the flutter_web forked libraries, but you have to be running on the beta channel.

If you are (you can switch to it using flutter channel beta and flutter upgrade as we’ve seen earlier), you need to enable web development by running flutter config –enable-web.

After doing that, you can run flutter run -d web and a local web server will be started from which you can access your app. The command returns the URL at which the server is listening, including the port number.

You can also run flutter build web to build the static website files in the build/ directory.

If those commands don’t work, run this command in the project directory to generate the required files to build in the web/ directory:

$ flutter create .

Packages for Installing Flutter


Other distributions have packages or community repositories to install and update in a more straightforward and intuitive way. However, at the time of writing, no such thing exists for Flutter. If you have experience packaging RPMs for Fedora, consider contributing to this GitHub repository for this COPR package.

The next step is learning Flutter. You can do that in a number of ways:

  • Read the good API reference documentation on the official site
  • Watching some of the introductory video courses available online
  • Read one of the many books out there today. [Check out the author’s bio for a suggestion! — Ed.]

Photo by Randall Ruiz on Unsplash.



https://www.sickgaming.net/blog/2020/01/...on-fedora/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Fedora - Now available: Fedora on Lenovo laptops! xSicKxBot 0 2 09-25-2020, 07:51 PM
Last Post: xSicKxBot
  Fedora - Installing and running Vagrant using qemu-kvm xSicKxBot 0 15 09-21-2020, 06:22 PM
Last Post: xSicKxBot
  Fedora - Incremental backups with Btrfs snapshots xSicKxBot 0 9 09-15-2020, 01:20 PM
Last Post: xSicKxBot
  Fedora - Ankur Sinha: How do you Fedora? xSicKxBot 0 20 09-11-2020, 02:22 PM
Last Post: xSicKxBot
  Fedora - Tune up your sound with PulseEffects: Microphones xSicKxBot 0 40 08-31-2020, 11:09 AM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Test Week for Btrfs xSicKxBot 0 42 08-26-2020, 01:20 PM
Last Post: xSicKxBot
  Fedora - Btrfs Coming to Fedora 33 xSicKxBot 0 47 08-24-2020, 01:28 PM
Last Post: xSicKxBot
  Fedora - Configure Fedora to practice and compose music xSicKxBot 0 38 08-22-2020, 12:44 PM
Last Post: xSicKxBot
  Fedora - Tune up your sound with PulseEffects: Speakers xSicKxBot 0 40 08-19-2020, 04:08 PM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Kernel and GNOME test days xSicKxBot 0 47 08-18-2020, 02:42 PM
Last Post: xSicKxBot

Forum Jump:

Become a Patron!
[-]
Upcoming Events

[-]
Latest Threads
Microsoft - Find out about storage optio...
Last Post: xSicKxBot
Today 01:12 AM
» Replies: 0
» Views: 3
News - Deathsmiles Collection Brings Mor...
Last Post: xSicKxBot
Today 01:12 AM
» Replies: 0
» Views: 3
News - Talking Point: What Are You Playi...
Last Post: xSicKxBot
Today 01:12 AM
» Replies: 0
» Views: 3
News - Fortnite Is Getting Special Chall...
Last Post: xSicKxBot
Today 01:12 AM
» Replies: 0
» Views: 3
[Tut] List Changes After Assignment — Ho...
Last Post: xSicKxBot
Today 12:14 AM
» Replies: 0
» Views: 3
(Indie Deal) Castlevania Collection, Gho...
Last Post: xSicKxBot
Today 12:13 AM
» Replies: 0
» Views: 4
Epic Games Have Acquired Super Awesome
Last Post: xSicKxBot
Yesterday 07:02 PM
» Replies: 0
» Views: 4
News - Mojang To Reveal Next Big Minecra...
Last Post: xSicKxBot
Yesterday 07:01 PM
» Replies: 0
» Views: 3
News - Fortnite Players Love The Lonely ...
Last Post: xSicKxBot
Yesterday 07:01 PM
» Replies: 0
» Views: 3
(Indie Deal) Borderlands 3 (-58%) & Kona...
Last Post: xSicKxBot
Yesterday 12:08 PM
» Replies: 0
» Views: 6

[-]
Twitter

[-]
Sponsored
Get the Deal of the Week at RefurBees.com

Copyright © SickGaming.net 2012-2020