Flutter is created by Google as a framework for development of Android and iOS mobile (and desktop) applications with the same code-base (GitHub repository, install Flutter). It lets using Material Design and Cupertino (iOS-flavor) widgets with native performance. Flutter is free and open source, it is already used by Google, Alibaba and other companies and developers.
In Flutter all elements are widgets . Layout is build in declarative way. Simplest program to run on mobile:
import 'package:flutter/material.dart'; void main() => runApp(Text('Some text', textDirection: TextDirection.ltr));
However Flutter has number of libraries and components with ready to use widgets and logic. For example:
- MaterialApp is a widget, which provides an application, that uses material design.
- AppBar is a widget, which consists of a toolbar and optionally other widgets, e.g. TabBar.
- Scaffold is a widget, which provides a default banner, background color, and has API for adding drawers, snack bars, and bottom sheets.
More easy to extend application would be like this:
import 'package:flutter/material.dart'; void main() => runApp(MaterialApp( title: 'My Application', home: Scaffold( appBar: AppBar(title: Text('My Title')), body: Center(child:Text('Some text'))) ) );
JSON and serialization
Commonly used JSON libraries (like GSON or Jackson) are not available in Flutter, because runtime reflection is disabled in Flutter, to provide tree shaking – “shake off” unused code from release builds, which significantly optimizes the app’s size. Alternatively `dart:convert` library can be used. It’s also possible to use Protocol Buffers (aka
ProtoBuf) with package protobuf and `proto` generating plugin protoc_plugin. Example of usage.
Flutter has many ready to use packages – libraries for particular purpose. To use a package – put package name (following with a colon
: character) to the
dependencies section of the
pubspec.yaml and hit the
Packages get link on the top of the editor (within AndroidStudio or IntelliJ IDEA with installed
dependencies: flutter: sdk: flutter flare_flutter: flutter_redux:
It’s also possible to upgrade packages – hit the
Packages upgrade link on the top of the editor with an open
pubspec.yaml file (within AndroidStudio or IntelliJ IDEA with installed
Read more details about using packages.
Some packages, which can be useful to be aware of in the beginning
- Databases and storages
- Reactive programming
- Immutable programming
- built_value – value types with builders, Dart classes as enums, and serialization.
- Getting Started
- Material Design guideline
- Dart programming style and conventions – consistent naming, ordering, and formatting helps code that is the same look the same.
- Cross platform desktop applications also can be built on Flutter: Desktop Embedding for Flutter. Tutorial . Read the Flutter application requirements document. This is not an officially supported Google product. Read Caveats regarding limitations.
- A tutorial to the power of Hero widgets in Flutter – Hero Animation is an element of one screen “flying” to the next when the app goes to the next page.
PS: 4th of December 2018, Flutter 1.0 was released. Google ran Flutter Live event – almost 5 hours of presentation about Flutter and its components. Flare was also launched same day – vector design and animation tool, supporting Flutter. Square SDKs integrate payments into Flutter apps – providing support for Square Reads and Square In-App Payments.