initialize static method

Future<void> initialize({
  1. required String androidChannelKey,
  2. required String iosChannelKey,
})

Initialize the Zendesk SDK for Android and iOS

@param androidChannelKey The Android SDK key generated from Zendesk dashboard @param iosChannelKey The iOS SDK key generated from the Zendesk dashboard

Implementation

static Future<void> initialize({required String androidChannelKey, required String iosChannelKey}) async {
  if (androidChannelKey.isEmpty || iosChannelKey.isEmpty) {
    debugPrint('ZendeskMessaging - initialize - keys can not be empty');
    return;
  }

  try {
    _channel.setMethodCallHandler(_onMethodCall); // start observing channel messages
    await _channel.invokeMethod('initialize', {
      'channelKey': Platform.isAndroid ? androidChannelKey : iosChannelKey,
    });
  } catch (e) {
    debugPrint('ZendeskMessaging - initialize - Error: $e}');
  }
}