MethodChannelAzureNotificationHub constructor
MethodChannelAzureNotificationHub()
Creates an instance of AzureNotificationHubPlatform that uses method channels.
Implementation
MethodChannelAzureNotificationHub() {
methodChannel.setMethodCallHandler((MethodCall call) async {
switch (call.method) {
case 'AzNotificationHub.onMessage':
AzureNotificationHubPlatform.onMessage
.add(Map<String, dynamic>.from(call.arguments));
break;
case 'AzNotificationHub.onMessageOpenedApp':
AzureNotificationHubPlatform.onMessageOpenedApp
.add(Map<String, dynamic>.from(call.arguments));
break;
case 'AzNotificationHub.onBackgroundMessage':
// iOS only! Android uses an isolate.
_onBackgroundMessage?.call(Map<String, dynamic>.from(call.arguments));
break;
default:
throw UnimplementedError('${call.method} has not been implemented');
}
});
}