handleIncomingCalls static method
Implementation
static Future<void> handleIncomingCalls(Function(IncomingCall) onCall) async {
instance._incomingChannel.setMethodCallHandler((call) async {
if (call.method == 'onEvent') {
final event = call.arguments['event'];
switch (event) {
case "onIncomingCall":
final callData = jsonDecode(call.arguments['data'].toString()) as Map<String, dynamic>;
_activeCall = IncomingCall.fromJson(callData);
onCall.call(_activeCall as IncomingCall);
break;
default:
throw Exception("Unknown call event! ${call.method}");
}
}
});
}