Follow this guide to integrate Portal into your Flutter App.
MethodChannel
enables sending messages that correspond to method calls. On the platform side, MethodChannel
on Android (MethodChannelAndroid) and FlutterMethodChannel
on iOS (MethodChanneliOS) enable receiving method calls and sending back a result. These classes allow you to develop a platform plugin with very little ‘boilerplate’ code.
You can check the Flutter official documentation for platform channels.
You can check our Portal Flutter example.
PortalSwift
to the iOS project, you can follow this setup.AppDelegate.swift
located under Runner > Runner in the project navigation.application:didFinishLaunchingWithOptions:
function and create a FlutterMethodChannel
The client and host sides of a channel are connected through a channel name passed in the channel constructor. All channel names used in a single app must be unique; prefix the channel name with a unique ‘identifier’, for example: your.bundle.identifier/portal
.
FlutterResult
which expected to be passed from Flutter side as a completion handler.
PortalWrapper
implementation:
MethodChannel
String
identifier initializePortal
. The call might fail, so wrap the invokeMethod
call in a try-catch statement.
initializePortal
to initialize portal is ready to be called. You can call it from Flutter side passing the apiKey to initialize Portal.
And that’s it! You’re now equipped to integrate Portal into your Flutter app.