Flutter (software)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Flutter
Google-flutter-logo.png
Original author(s)Google
Developer(s)Google and community
Initial releaseAlpha (v0.0.6) / May 2017; 2 years ago (2017-05)[1]
Stable release
v1.12.13+hotfix.5 / December 11, 2019; 1 day ago (2019-12-11)[2]
Preview release
v1.13 / November 24, 2019; 18 days ago (2019-11-24)[3]
Written inC, C++, Dart[4]
PlatformAndroid, iOS, Google Fuchsia, Web platform, Windows, macOS and Linux
TypeApplication framework
LicenseNew BSD License
Websiteflutter.dev

Flutter is an open-source UI software development kit created by Google. It is used to develop applications for Android, iOS, Windows, Mac, Linux, Google Fuchsia[5] and the web.

The first version of Flutter was known as codename "Sky" and ran on the Android operating system. It was unveiled at the 2015 Dart developer summit, with the stated intent of being able to render consistently at 120 frames per second.[6] During the keynote of Google Developer Days in Shanghai, Google announced Flutter Release Preview 2 which is the last big release before Flutter 1.0. On December 4, 2018, Flutter 1.0 was released at the Flutter Live event, denoting the first "stable" version of the Framework.[7] On December 11, 2019, Flutter 1.12 was released at the Flutter Interactive event, it was announced that Flutter was the first UI platform designed for ambient computing[8]

Framework architecture[edit]

The major components of Flutter include:

  • Dart platform
  • Flutter engine
  • Foundation library
  • Design-specific widgets

Dart platform[edit]

Flutter apps are written in the Dart language and make use of many of the language's more advanced features.[9]

On Windows, macOS and Linux via the semi-official Flutter Desktop Embedding project, Flutter runs in the Dart virtual machine which features a just-in-time execution engine. While writing and debugging an app, Flutter uses Just In Time compilation, allowing for "hot reload", with which modifications to source files can be injected into a running application. Flutter extends this with support for stateful hot reload, where in most cases changes to source code can be reflected immediately in the running app without requiring a restart or any loss of state.[10] This feature as implemented in Flutter has received widespread praise[citation needed].

Release versions of Flutter apps are compiled with ahead-of-time (AOT) compilation on both Android and iOS,[11] making Flutter's high performance on mobile devices possible.

Flutter engine[edit]

Flutter's engine, written primarily in C++, provides low-level rendering support using Google's Skia graphics library. Additionally, it interfaces with platform-specific SDKs such as those provided by Android and iOS.[9] The Flutter Engine is a portable runtime for hosting Flutter applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. Most developers will interact with Flutter via the Flutter Framework, which provides a modern, reactive framework, and a rich set of platform, layout and foundation widgets.

Foundation library[edit]

The Foundation library, written in Dart, provides basic classes and functions which are used to construct applications using Flutter, such as APIs to communicate with the engine.[9][12]

Widgets[edit]

UI design in Flutter involves using composition to assemble / create "Widgets" from other Widgets. The trick to understanding this is to realize that any tree of components (Widgets) that is assembled under a single build() method is also referred to as a single Widget. This is because those smaller Widgets are also made up of even smaller Widgets, and each has a build() method of its own. This is how Flutter makes use of Composition.

The docs say: " A widget is an immutable description of part of a user interface." A human being will tell you it's a Blueprint, which is a much easier way to think about it. However, one also needs to keep in mind there are many types of Widgets in Flutter, and you cannot see or touch all of them. Text is a Widget, but so is its TextStyle, which defines things like size, color, font family and weight. There are Widgets that represent things, ones that represent characteristics (like TextStyle) and even others that do things, like FutureBuilder and StreamBuilder.

Complex widgets can be created by combining many simpler ones, and an app is actually just the largest Widget of them all (often called "MyApp"). The MyApp Widget contains all the other Widgets, which can contain even smaller Widgets, and together they make up your app.

However, the use of widgets is not strictly required to build Flutter apps. An alternative option, usually only used by people who like to control every pixel drawn to the canvas, is to use the Foundation library's methods directly. These methods can be used to draw shapes, text, and imagery directly to the canvas. This ability of Flutter has been utilized in a few frameworks, such as the open-source Flame game engine.

Design-specific widgets[edit]

The Flutter framework contains two sets of widgets which conform to specific design languages. Material Design widgets implement Google's design language of the same name, and Cupertino widgets implement Apple's Human Interface Guidelines iOS design.[9][13][14][15]

Hello World Example[edit]

A Hello, World program in Flutter looks like this:

 1 import 'package:flutter/material.dart';
 2 
 3 void main() => runApp(HelloWorldApp());
 4 
 5 class HelloWorldApp extends StatelessWidget {
 6   @override
 7   Widget build(BuildContext context) {
 8     return MaterialApp(
 9       title: 'Hello World App',
10       home: Scaffold(
11         appBar: AppBar(
12           title: Text('Hello World App'),
13         ),
14         body: Center(
15           child: Text('Hello World'),
16         ),
17       ),
18     );
19   }
20 }

References[edit]

  1. ^ Chris Bracken. "Release v0.0.6: Rev alpha branch version to 0.0.6, flutter 0.0.26 (#10010) · flutter/flutter". GitHub. Retrieved 2018-08-08.
  2. ^ "Flutter SDK releases". flutter.dev.
  3. ^ "Flutter makes it easy and fast to build beautiful mobile apps.: flutter/flutter". July 29, 2019 – via GitHub.
  4. ^ "FAQ - Flutter". Retrieved 2018-08-08.
  5. ^ "Google's "Fuchsia" smartphone OS dumps Linux, has a wild new UI". Ars Technica.
  6. ^ Amadeo, Ron (1 May 2015). "Google's Dart language on Android aims for Java-free, 120 FPS apps". Ars Technica.
  7. ^ "Speed Up Native Development As Google Flutter Comes Out Of Beta". Appetiser Apps. Retrieved 2018-12-21.
  8. ^ "Flutter: the first UI platform designed for ambient computing". Flutter blog. Retrieved 2019-12-11.
  9. ^ a b c d "Technical Overview - Flutter". flutter.dev. Retrieved 2017-12-13.
  10. ^ Lelel, Wm (26 February 2018). "Why Flutter Uses Dart". HackerNoon. Retrieved 5 December 2018.
  11. ^ stephenwzl (2018-08-01). "Flutter's Compilation Patterns". ProAndroidDev. Retrieved 2018-12-06.
  12. ^ "foundation library - Dart API". docs.flutter.dev. Retrieved 2017-12-13.
  13. ^ "Material Design Widgets - Flutter". flutter.dev. Retrieved 2017-12-13.
  14. ^ "Cupertino (iOS-style) Widgets - Flutter". flutter.dev. Retrieved 2017-12-13.
  15. ^ "Human Interface Guidelines". developer.apple.com. Retrieved 2019-10-08.

External links[edit]