Skip to content

Instantly share code, notes, and snippets.

@nparsons08 nparsons08/api_service.dart Secret

Created Mar 2, 2020
Embed
What would you like to do?
// mobile/lib/api_service.dart:69
Future<CancelListening> listenToChannel(Map account, String userToChatWith, Listener listener) async {
var channelId = await platform.invokeMethod<String>(
'setupChannel', {'user': account['user'], 'userToChatWith': userToChatWith, 'token': account['chatToken']});
var subscription = EventChannel('io.getstream/events/$channelId').receiveBroadcastStream(nextListenerId++).listen(
(results) {
listener(json.decode(results));
},
cancelOnError: true,
);
return () {
subscription.cancel();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.