1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

Add plugin and host registration to multiple_flutters example (#942)

This commit is contained in:
Jenn Magder
2021-10-29 09:41:23 -07:00
committed by GitHub
parent eb74d3f380
commit 05a3263eb4
7 changed files with 104 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import Flutter
import FlutterPluginRegistrant
import Foundation
/// A FlutterViewController intended for the MyApp widget in the Flutter module.
@@ -16,6 +17,7 @@ class SingleFlutterViewController: FlutterViewController, DataModelObserver {
init(withEntrypoint entryPoint: String?) {
let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
let newEngine = appDelegate.engines.makeEngine(withEntrypoint: entryPoint, libraryURI: nil)
GeneratedPluginRegistrant.register(with: newEngine)
super.init(engine: newEngine, nibName: nil, bundle: nil)
DataModel.shared.addObserver(observer: self)
}