configure static method

Future<Fingerly> configure(
  1. FingerlyConfig config
)

Configure the SDK from a FingerlyConfig and return a client.

Equivalent to load, accepting a typed configuration object.

Implementation

static Future<Fingerly> configure(FingerlyConfig config) async {
  final projectNumber = config.playIntegrityCloudProjectNumber;
  if (projectNumber != null && projectNumber <= 0) {
    throw ArgumentError.value(
      projectNumber,
      'playIntegrityCloudProjectNumber',
      'must be a positive number',
    );
  }

  await _invokeVoid('configure', {
    'apiKey': config.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': config.endpoint,
    'platform': _platformName(),
    'consent': config.consent.name,
    // Sent only when set. Safely ignored on iOS.
    if (projectNumber != null)
      'playIntegrityCloudProjectNumber': projectNumber,
  });

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