void init() { if (isInitalized) { return; } FlutterHotReloadHelper.HotReloadHandler = this; isInitalized = true; GeneratedPluginRegistrant.Register(Engine); MethodChannel = FlutterMethodChannel.FromNameAndMessenger("com.Microsoft.FlutterSharp/Messages", Engine.BinaryMessenger); Flutter.Internal.Communicator.SendCommand = (x) => MethodChannel.InvokeMethod(x.Method, (NSString)x.Arguments); MethodChannel.SetMethodCaller((call, result) => { if (call.Method == "ready" && Widget != null) { isReady = true; FlutterManager.SendState(Widget); } Flutter.Internal.Communicator.OnCommandReceived?.Invoke((call.Method, call.Arguments.ToString(), (x) => { result((NSString)x); } )); }); }
partial void UIButton197_TouchUpInside(UIButton sender) { Console.WriteLine("Tapped!"); var flutterEngine = new FlutterEngine(""); flutterEngine.Run(); GeneratedPluginRegistrant.RegisterWithRegistry(flutterEngine); var vc = new FlutterViewController(flutterEngine, null, null); PresentViewController(vc, true, null); }
private void EnsureFlutterEngineCreated(string engineId) { if (!FlutterEngineCache.Instance.Contains(engineId)) { var flutterEngine = new FlutterEngine(this); GeneratedPluginRegistrant.RegisterWith(flutterEngine); flutterEngine.DartExecutor.ExecuteDartEntrypoint( DartExecutor.DartEntrypoint.CreateDefault() ); FlutterEngineCache.Instance.Put(engineId, flutterEngine); } }
public override void ViewDidLoad() { base.ViewDidLoad(); var flutterEngine = new FlutterEngine(""); flutterEngine.Run(); GeneratedPluginRegistrant.RegisterWithRegistry(flutterEngine); var vc = new FlutterViewController(flutterEngine, null, null); AddChildViewController(vc); View.AddSubview(vc.View); vc.View.Frame = new CoreGraphics.CGRect( View.Frame.Location.X, View.Frame.Location.Y, View.Frame.Size.Width, View.Frame.Size.Height / 2); vc.DidMoveToParentViewController(this); }
protected override void OnCreate() { base.OnCreate(); GeneratedPluginRegistrant.RegisterPlugins(this); }