I am making an app in which I stream data from native android and iOS side to flutter side and there I display the data in the UI.
I already did the android part. The android part is sending the data to flutter side and displays them in UI. But the problem is how to achieve same for iOS swift side.
Android code that works for me:
new EventChannel(getFlutterView(), "Eventchannelname").setStreamHandler(
new EventChannel.StreamHandler() {
@Override
public void onListen(Object args, EventChannel.EventSink events) {
Log.w(TAG, "adding listener");
mEventSink = events; // I use mEventsink.success(data) to pass the data to flutter side
@Override
public void onCancel(Object args) {
Log.w(TAG, "cancelling listener");
}
}
);
How can I achieve the same in Swift native code. I googled it and did not find anything that can help me.
I want same in swift as what I did in android java: I want to capture the events in local variable and then use that where I need to send data to flutter.