How to Add Flutter to an Existing iOS and Android App — Ant Media Server

Ant Media Server
2 min readOct 12, 2022

Rebuilding your existing application in Flutter can be tedious and time-consuming. For these cases, Flutter can be integrated piecemeal into your existing application as a library or module. You can then import this module into your Android or iOS app to render part of your app’s UI in Flutter.

You can easily rebuild your existing app in Flutter in a few steps.

The add-to-app the feature supports integrating multiple instances of any screen size. This can help scenarios such as a hybrid navigation stack with mixed native and Flutter screens, or a page with multiple partial-screen Flutter views.

Having multiple Flutter instances allows each instance to maintain an independent application and UI state while using minimal memory resources. See more on the multiple Flutters page.

Adding Flutter to an Existing iOS and Android App

You can add Flutter to your Android and iOS apps by following the basic steps below. Let’s start with the Android app!

Adding Flutter to Android App

  • Auto-build and import the Flutter module by adding a Flutter SDK hook to your Gradle script.
  • Build your Flutter module into a genericAndroid Archive (AAR)for integration into your own build system and for better Jetifier interoperability with AndroidX.
  • FlutterEngineAPI for starting and persisting your Flutter environment independently of attaching aFlutterActivity/FlutterFragmentetc.
  • Android Studio Android/Flutter co-editing and module creation/import wizard.
  • Java and Kotlin host apps are supported.
  • Flutter modules can useFlutter pluginsto interact with the platform.
  • Support for Flutter debugging and stateful hot reload by usingflutter attachIDEs or the command line to connect to an app that contains Flutter.

Adding Flutter to iOS App

  • Auto-build and import the Flutter module by adding a Flutter SDK hook to your CocoaPods and to your Xcode build phase.
  • Build your Flutter module into a genericiOS Frameworkfor integration into your own build system.
  • FlutterEngineAPI for starting and persisting your Flutter environment independently of attaching aFlutterViewController.
  • Objective-C and Swift host apps are supported.
  • Flutter modules can useFlutter pluginsto interact with the platform.
  • Support for Flutter debugging and stateful hot reload by usingflutter attachIDEs or the command line to connect to an app that contains Flutter.

Originally published at https://antmedia.io on October 12, 2022.

--

--

Ant Media Server

Ant Media Server, open source software, supports publishing live streams with WebRTC and RTMP. It supports HLS(HTTP Live Streaming) and MP4 as well.