06 Aug 2020
Flutter 1.20

Announcing Flutter 1.20

So Flutter 1.20 is now out and this is what Flutter has for all of us in store for this time

1) Reduce shader compilation jank on mobile

If the animations on your mobile app appear to be janky, but only on the first run, you can warm up the shader captured in the Skia Shader Language (SkSL) for a significant improvement.

Image for post

If an app has janky animations during the first run, and later becomes smooth for the same animation, then it’s very likely due to shader compilation jank.

More technically, a shader is a piece of code that runs on a GPU (graphics processing unit). When a shader is first used, it needs to be compiled on the device. The compilation could cost up to a few hundred milliseconds whereas a smooth frame needs to be drawn within 16 milliseconds for a 60 fps (frame-per-second) display. Therefore, a compilation could cause tens of frames to be missed, and drop the fps from 60 to 6. This is compilation jank. After the compilation is complete, the animation should be smooth.

How to use SkSL warmup

Use the following instructions to collect and package the SkSL shaders:

flutter run --profile --cache-sksl
  • Play with the app to trigger as many animations as needed; particularly those with compilation jank.
  • Press M at the command line of flutter run to write the captured SkSL shaders into a file named something like flutter_01.sksl.json.
  • Build the app with SkSL warm-up using the following, as appropriate:
  • Android:
flutter build apk --bundle-sksl-path flutter_01.sksl.json
  • iOS:
flutter build ios --bundle-sksl-path flutter_01.sksl.json
  • Test the newly built app.
flutter drive --profile --cache-sksl --write-sksl-on-exit flutter_01.sksl.json -t test_driver/app.dart

With such integration tests, you can easily and reliably get the new SkSLs when the app code changes, or when Flutter upgrades. Such tests can also be used to verify the performance change before and after the SkSL warm-up. Even better, you can put those tests into a CI (continuous integration) system so the SkSLs are generated and tested automatically over the lifetime of an app.

2) Developing for iOS 14 beta

  • Developing for iOS 14 beta outlines some issues you might run into if developing for devices running iOS 14 beta.
  • The iOS 14 release, the new version of Apple’s mobile operating system, is coming. As it’s not yet stable, we don’t fully support it yet.
  • But we have some tips to get you up and running — assuming that you don’t mind being on the leading edge.

Using hot reload

When you run your app for the first time in debug mode, iOS 14 presents a popup dialog asking you to allow local network connections. If you choose Don’t Allow, hot reload won’t work, because it prevents the app from talking to Observatory.

Image for post

Solution: Choose OK to allow local network connections.

Just to be clear: this only happens in debug mode. Your users won’t see this message in release mode. Only the debug version of your app needs to access the local network.

3) New instructions for installing Flutter on Linux using snapd

4) Updated the Desktop support page to reflect that Linux desktop apps (as well as macOS) are available as alpha.

Requirements

For macOS desktop development, you need the following in addition to the Flutter SDK:

For Linux desktop development, you need the following in addition to the Flutter SDK:

The easiest way to install the Flutter SDK along with these dependencies is by using snapd.

Once you have snapd, you can install Flutter using the Snap Store, or at the command line:

sudo snap install flutter --classic

If snapd is unavailable on the Linux distro you’re using, you might use the following command:

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev

Create a new project

You can use the following steps to create a new project with desktop support.

Set up

flutter channel dev
flutter upgrade
flutter config --enable-<platform>-desktop

Where <platform> is either macos or linux:

flutter config --enable-macos-desktop
flutter config --enable-linux-desktop

To ensure that the desktop is installed, list the devices available. You should see something like the following (you’ll see either macOS or Linux, not both):

flutter devices
1 connected device:macOS desktop • macos • darwin-x64 • Mac OS X 10.15.5 19F101
Linux desktop • linux • linux-x64 • Linux

To launch your app from the command line, enter one of the following from the top of the package:

flutter run -d macos
flutter run -d linux

Build a release app

To generate a release build run one of the following commands:

flutter build macos
flutter build linux

5) Null safety has been added to dart.dev

For understanding null safety, you call follow this link – Understanding null safety

About Philomathes Jigyasu

Philomathes (pronounced as fillo-MAY-thus) is a fictional character at VAYUZ (https://www.vayuz.com), who is on a never ending journey called “LEARNING”. In a way, Philomathes embodies VAYUZ - Way of life, which is if you are not learning then you are not breathing. The word Philomathes, comes from the Greek roots philo and philein meaning "to love" and the Greek roots mathos (MAH-thos) and mathesis (muh-THAYSIS) meaning “learning”.Philomathes through his Blogs and Vlogs (Video Blogs) will share his experience, learnings and thoughts. In his tryst to learn and understand, he would also seek answers to questions. So if you would like to join him in this incredible journey called “ life” then feel free to write to him on philomathes.jigyasu@vayuz.com.Always remember, knowledge is all around us, we just need to keep our guards down and senses on.

Leave a Comment