start method

void start()

Prepares necessary infrastructure to communicate with native side and launches Talsec on native to check device for threats.

Implementation

void start() {
  /// Android device
  final androidConfig = _config.androidConfig;
  final iosConfig = _config.iosConfig;

  if (Platform.isAndroid && androidConfig != null) {
    _configChannel.invokeListMethod<void>('setConfig', <String, dynamic>{
      'expectedPackageName': androidConfig.expectedPackageName,
      'expectedSigningCertificateHashes':
          androidConfig.expectedSigningCertificateHashes,
      'watcherMail': _config.watcherMail,
      'supportedAlternativeStores': androidConfig.supportedAlternativeStores
    });
  }

  /// iOS device
  else if (Platform.isIOS && iosConfig != null) {
    _configChannel.invokeListMethod<void>('setConfig', <String, String?>{
      'appBundleId': iosConfig.appBundleId,
      'appTeamId': iosConfig.appTeamId,
      'watcherMail': _config.watcherMail,
    });
  } else {
    throw MissingPluginException(
        '${Platform.isAndroid ? "androidConfig" : "IOSconfig"} is not '
        'provided.');
  }

  /// Listen to changes from native side
  _setListener(_channel);
}