initialize static method

Future<void> initialize({
  1. bool enableLogs = false,
})

Initialize platform channels and listeners. Call once at app start.

Implementation

static Future<void> initialize({bool enableLogs = false}) async {
  if (_initialized) return;
  _logsEnabled = enableLogs;
  _queue ??= SmartLinkQueue(onEmit: _deliver);

  if (kIsWeb) {
    await _initWeb();
  } else if (defaultTargetPlatform == TargetPlatform.android) {
    await _initAndroid();
  } else {
    _log('SmartLink: platform not supported');
  }

  _initialized = true;
  _log('SmartLink initialized');
}