Add Flutter to existing App
Thais Aquino
Android/Flutter developer
from GDG Adelaide
@thaisandrade_s
Slide 2
Slide 2 text
Flutter
Flutter is Google’s UI toolkit for building beautiful, natively compiled
applications for mobile, web, and desktop from a single codebase.
Slide 3
Slide 3 text
Why add Flutter to existing project?
Share code logic between Android and iOS (or other platforms)
Don’t have time to rewrite everything
Serve a feature in Flutter using A/B or feature flag
You already have an app in production
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
Add to App feature
Released in version 1.12
Limitations:
● Running multiple Flutter instances or running in partial screen
views may have undefined behavior
● Using Flutter in background mode is still a WIP
Slide 6
Slide 6 text
Add Flutter module to Android project
1. Open existing project
2. New Flutter module wizard
3. Use Flutter Android APIs (to start an activity with Flutter screen for
example)
4. Build & Run
5. Attach & Hot Reload
https://flutter.dev/docs/development/add-to-app#add-to-android-applications
Slide 7
Slide 7 text
Add Flutter module: Wizard
File > New > New Module
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
settings.gradle
Slide 10
Slide 10 text
build.gradle
Slide 11
Slide 11 text
AndroidManifest.xml
Slide 12
Slide 12 text
Starting an Activity Every FlutterActivity creates its
own FlutterEngine
Delay to warm up the engine
You can use a cached engine
instead and optimize
Slide 13
Slide 13 text
Example in GitHub
github.com/tasaquino/add_flutter_to_app_example
Slide 14
Slide 14 text
What about sharing logic?
You can use Platform Channels to communicate between the existing
app and the Flutter module. In order to write Dart code for logic and use
it in the host app.
Slide 15
Slide 15 text
No content
Slide 16
Slide 16 text
Thank you
@thaisandrade_s
speakerdeck.com/thaisaquino