load static method

Future<Fingerly> load({
  1. required String apiKey,
  2. String endpoint = '',
  3. ConsentState consent = ConsentState.pending,
})

Configure the SDK and return a client.

The key is a publishable SDK key from the dashboard, and it is safe in a shipped binary — it is scoped to the app identifiers you list. A secret key is refused when it arrives from a client, so pasting one in does not work by design.

consent is the state to start from, ConsentState.pending by default: call setConsent once the app's consent tool has an answer, and until it is ConsentState.granted, identify and collect throw FingerlyConsentException. Pass ConsentState.granted here only once the user has agreed, or where another lawful basis applies. Loading collects and sends nothing, whatever the consent, and the state passed here replaces whatever the native SDK held before.

Implementation

static Future<Fingerly> load({
  required String apiKey,
  String endpoint = '',
  ConsentState consent = ConsentState.pending,
}) async {
  await _invokeVoid('configure', {
    'apiKey': apiKey,
    // Empty means "use the native default". Not null: the native signature
    // takes a non-null string, and a null across the channel fails the
    // argument check rather than falling back.
    'endpoint': endpoint,
    'platform': _platformName(),
    'consent': consent.name,
  });

  _consent = consent;
  return const Fingerly._();
}