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 - Build your own cloud with Fedora 31 and Nextcloud Server xSicKxBot 0 2 7 hours ago
Last Post: xSicKxBot
  Fedora - Thunderbolt – how to use keyboard during boot time xSicKxBot 0 3 01-25-2020, 11:49 AM
Last Post: xSicKxBot
  Fedora - Set up an offline command line dictionary in Fedora xSicKxBot 0 9 01-23-2020, 08:01 AM
Last Post: xSicKxBot
  Fedora - Learning about Partitions and How to Create Them for Fedora xSicKxBot 0 20 01-21-2020, 06:57 AM
Last Post: xSicKxBot
  Fedora - Fedora CoreOS out of preview xSicKxBot 0 27 01-18-2020, 09:40 AM
Last Post: xSicKxBot
  Fedora - How to setup a DNS server with bind xSicKxBot 0 57 01-14-2020, 09:50 AM
Last Post: xSicKxBot
  Fedora - How to setup multiple monitors in sway xSicKxBot 0 41 01-09-2020, 08:29 AM
Last Post: xSicKxBot
  Fedora - Most read articles in 2019 not from 2019 xSicKxBot 0 39 01-07-2020, 10:37 AM
Last Post: xSicKxBot
  Fedora - Tracking Translations with Transtats xSicKxBot 0 44 01-04-2020, 06:23 AM
Last Post: xSicKxBot
  Fedora - Top articles of 2019: Editors’ choice xSicKxBot 0 45 12-31-2019, 06:22 AM
Last Post: xSicKxBot

Forum Jump:

[-]
Welcome
You have to register before you can post on our site.

Username:


Password:





[-]
Statistics
» Members: 12,006
» Latest member: matthew.devasure
» Forum threads: 11,107
» Forum posts: 11,501

Full Statistics

[-]
Online Staff
There are no staff members currently online.

[-]
Discord

[-]
Latest Threads
News - Netflix's Ghost In The Shell Show...
Last Post: xSicKxBot
Today 03:19 PM
» Replies: 0
» Views: 0
[Tut] Python Re Dot
Last Post: xSicKxBot
Today 08:01 AM
» Replies: 0
» Views: 5
[Tut] How to Create Popup Contact Form D...
Last Post: xSicKxBot
Today 08:01 AM
» Replies: 0
» Views: 3
(Indie Deal) ?Crypto Lunar New Year Sale...
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 60
Ursina Engine
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 3
Mobile - Star Realms follow-up Epic rele...
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 3
Fedora - Build your own cloud with Fedor...
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 2
News - 2K Joins The Rest Of The World In...
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 2
News - Gorgeous Pokemon Skateboards Are ...
Last Post: xSicKxBot
Today 08:00 AM
» Replies: 0
» Views: 2
[Oracle Blog] 2019 Duke's Choice Award N...
Last Post: xSicKxBot
Today 02:23 AM
» Replies: 0
» Views: 4

[-]
Twitter

[-]
Recent Posts
News - Netflix's Ghost In The Shell Show...
Netflix's Ghost In T...xSicKxBot — 03:19 PM
[Tut] Python Re Dot
Python Re Dot You&#...xSicKxBot — 08:01 AM
[Tut] How to Create Popup Contact Form D...
How to Create Popup ...xSicKxBot — 08:01 AM
(Indie Deal) ?Crypto Lunar New Year Sale...
?Crypto Lunar New Ye...xSicKxBot — 08:00 AM
Ursina Engine
Ursina Engine The U...xSicKxBot — 08:00 AM

[-]
Top Poster
no avatar Congratulations to xSicKxBot, our current top poster for the last day with 18 posts!

Copyright © SickGaming.net 2012-2019