init method

Future<void> init({
  1. bool useTestKey = false,
  2. bool enableLog = false,
  3. bool disableTrack = false,
  4. DeferredDeepLink? onLinkReceived,
})

Initializes Branch link handling.

Implementation

Future<void> init({
  bool useTestKey = false,
  bool enableLog = false,
  bool disableTrack = false,
  DeferredDeepLink? onLinkReceived,
}) async {
  await FlutterBranchSdk.init(
      useTestKey: useTestKey,
      enableLogging: enableLog,
      disableTracking: disableTrack);

  FlutterBranchSdk.listSession().listen((data) {
    try {
      DeepLinkNavigator().navigateToScreen(data);
    } on Exception catch (_) {}

    try {
      if (data.isNotEmpty) {
        onLinkReceived?.call(data);
      }
    } on Exception catch (_) {}
  });
}