getConsentStatus static method

Future<GdprConsentStatus> getConsentStatus()

Returns the current consent status.

This value is cached by the underlying mechanisms and not exactly reliable.

Implementation

static Future<GdprConsentStatus> getConsentStatus() async {
  late GdprConsentStatus ret;
  ConsentStatus status = await ConsentInformation.instance.getConsentStatus();

  switch (status) {
    case ConsentStatus.notRequired:
      ret = GdprConsentStatus.notRequired;
    case ConsentStatus.obtained:
      ret = GdprConsentStatus.obtained;
    case ConsentStatus.required:
      ret = GdprConsentStatus.required;
    case ConsentStatus.unknown:
      ret = GdprConsentStatus.unknown;
  }

  _log('ConsentStatus: $ret');
  return ret;
}