Flutter
František Gažo
First impressions...
@franky on
What is Flutter?
- mobile app SDK - Android & iOS
- developed by Google
- DART
- open-source on GitHub
- still alpha
Cross-platform frameworks
- WebView based - PhoneGap, Apache Cordova, Ionic, ...
- React Native
- Flutter
Why Flutter?
- IDE plugins
- hot reload
- compatibility - Android 4.1+, iOS 8.0+
- AOT to native code
- full control over the widgets
- provides beautiful, customizable widgets
- single codebase
Findings...
Setup
- https://flutter.io/setup/
- quick & simple
-
flutter doctor
-
flutter create app_name [-a kotlin -i swift -org my.package.name]
-
flutter run [--release]
-
flutter devices
Channels
- for communication with the platform
- access data, start services, show native UI screen
- send async messages
- https://flutter.io/platform-channels/
Cross-platform libs = Plugins
- SharedPreferences (iOS UserDefaults)
- sqflite
- URL launcher
- HTTP
- Firebase
- ...
- https://pub.dartlang.org/
Localization
- flutter_localization
- simple solution
- intl & intl_translation
- gender, plural, fallback to default language
Testing
- flutter_test
- https://flutter.io/testing/#unit-testing
- unit testing
- mockito
- https://pub.dartlang.org/packages/mockito
- mock library for dart
-
IDE alebo $ flutter test
Video
- flutter lib:
- https://pub.dartlang.org/packages/video_player
- flutter lib
- chewie
- https://pub.dartlang.org/packages/chewie
- 3rd party lib with controlls
Reflection vs Code Generation
- reflection is not supported
- all libs use code generation
- dart tree-shaking
- include large lib, use only what you need
API
- http
- https://pub.dartlang.org/packages/http
- Future-based library for making HTTP requests
- simple
- easy request/response interception
- header manipulation
- no cookie manager lib
- JSON support
- https://flutter.io/json/
- manually or via library
- json_serializable : https://pub.dartlang.org/packages/json_serializable
Resources
- shared assets for flutter part
- support for 1.0x, 2.0x a 3.0x image variants
- great library of material design icons
- no SVG support
- (open issue: https://github.com/flutter/flutter/issues/1831)
Build Flavors
- define in each platform
- propagate through a channel (no plugin yet)
- no flavor specific code/asset directory support
$ flutter run --flavor free
$ flutter run --flavor paid
Debugging & Profiling
- open flutter project in AndroidStudio (IntelliJ)
-
flutter plugin adds:
- toggle platform, slow animation, debug paint, performance overlay, widget hierarchy
- dart only debugging
- AndroidStudio profiler is hidden
-
flutter plugin adds:
- open android part in AndroidStudio / iOS in Xcode
Background processing
- run Dart code in a background service
- implementation is in-progress
- open issues:
- AlarmManager plugin for Android only: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager
Logging
WebView support
- no inline view support yet: https://github.com/flutter/flutter/issues/730
- plugin : https://github.com/dart-flitter/flutter_webview_plugin
- using platform specific screen overlay
- load html: https://github.com/dart-flitter/flutter_webview_plugin/issues/23#issuecomment-367618709
Cons
- no state management (https://github.com/flutter/flutter/issues/6827)
-
problem with swift support (https://github.com/flutter/flutter/issues/14551)when using firebase
- no interactive map view (https://github.com/flutter/flutter/issues/73)
-
map_view
- https://pub.dartlang.org/packages/map_view
- only static map with a click to fullscreen map
-
map_view
- no fully featured chart lib
More
Thanks
Flutter - First Impressions
By František Gažo
Flutter - First Impressions
- 1,074