init static method

Future init(
  1. String appKey,
  2. PusherOptions options, {
  3. bool enableLogging = false,
})

Setup app key and options

Implementation

static Future init(
  String appKey,
  PusherOptions options, {
  bool enableLogging = false,
}) async {
  assert(appKey != null);
  assert(options != null);

  _eventChannel.receiveBroadcastStream().listen(_handleEvent);

  final initArgs = jsonEncode(InitArgs(
    appKey,
    options,
    isLoggingEnabled: enableLogging,
  ).toJson());

  await _channel.invokeMethod('init', initArgs);
}