A demonstrable flutter integration into an existing codebase, with the help of platform channels.
DISCLAIMER: Since Flutter's "Add-to-App" functionality is in preview, the associated APIs and tooling are not stable and are subject to change.
This repo demonstrate 2 possible use cases on how you can add your Flutter views in your existing codebase:
- View Embedding
- Entire Screen
Some docs and blog that you will need to continue your journey in maximizing Flutter Add-to-App feature.
- Flutter Add-to-App docs
- Flutter Add-to-App project board
- Flutter Platform Channels docs
- Platform Channels Blog
Another project I wrote where I introduced Google Protobuf for serializing the platform channels data.
a. Setup Flutter
$ flutter channel master
$ flutter upgrade
$ flutter packages get
b. Setup Android
$ cd flutter
$ flutter build apk
$ cd .. && cd android
$ ./gradlew installDebug
c. Setup iOS
$ cd flutter
$ flutter build ios
$ cd .. && cd ios
$ pod install
$ open flutter_addtoapp_basic_ios.xcworkspace
Attach (Running alongside native platform)
$ flutter attach
Debug
$ flutter run --verbose
Release
$ flutter run --verbose --release
Profile
$ flutter run --verbose --profile
$ flutter run test/<TEST_FILE.dart>
Available channels
Name | Type |
---|---|
channel-username |
MethodChannel |
channel-embedded-messages |
BasicMessageChannel<String> |
Available routes
Name | Widget | Description |
---|---|---|
/flutter-screen |
FlutterScreen |
Shows a full screen Flutter view. Presented as an Activity or ViewController in Android and iOS respectively. |
/flutter-embedded-view |
FlutterEmbeddedView |
Shows a particular section of the app in Flutter. |
I would highly appreciate if we connect on Twitter or Github, and discuss Fluttery things over a cup of coffee ☕.
- Twitter: @joshuamdeguzman
- Github: @joshuadeguzman
- Email: contact@jdg.ph
- Telegram: @joshuadeguzman
flutter-addtoapp-basic-demo is released under the BSD-3 Clause License. See LICENSE for details.