urlCheck static method

Future<List<UrlCheckThreat>> urlCheck(
  1. String url,
  2. String appId,
  3. List<UrlThreatType> urlThreatTypes
)

Initiates a URL check request.

Implementation

static Future<List<UrlCheckThreat>> urlCheck(
  String url,
  String appId,
  List<UrlThreatType> urlThreatTypes,
) async {
  final List<int> threatTypesValues = <int>[];
  for (UrlThreatType urlThreatType in urlThreatTypes) {
    if (urlThreatType == UrlThreatType.malware) {
      threatTypesValues.add(1);
    } else if (urlThreatType == UrlThreatType.phishing) {
      threatTypesValues.add(3);
    }
  }
  final List<dynamic> result = await _methodChannel.invokeMethod(
    'urlCheck',
    <String, dynamic>{
      'url': url,
      'appId': appId,
      'threatTypes': threatTypesValues,
    },
  );
  return List<UrlCheckThreat>.from(
    result.map(
      (dynamic e) => UrlCheckThreat.fromInt(e),
    ),
  );
}