getVisitorId static method

Future<String?> getVisitorId({
  1. Object? tags,
  2. String? linkedId,
  3. int? timeoutMs,
})

Returns the visitorId generated by the native Fingerprint Pro client Support tags Support linkedId Support timeoutMs Throws a FingerprintProError if identification request fails for any reason

Implementation

static Future<String?> getVisitorId(
    {Object? tags, String? linkedId, int? timeoutMs}) async {
  if (!_isInitialized) {
    throw Exception(
        'You need to initialize the FPJS Client first by calling the "initFpjs" method');
  }

  try {
    FingerprintJSAgent fp = await (_fpPromise as Future<FingerprintJSAgent>);
    var result = await promiseToFuture(fp.get(FingerprintJSGetOptions(
        linkedId: linkedId, tag: tags, timeout: timeoutMs)));
    return result.visitorId;
  } catch (e) {
    if (e is WebException) {
      throw unwrapWebError(e);
    } else {
      throw UnknownError(e.toString());
    }
  }
}