showConsentForm method

Future<ConsentInformation> showConsentForm()

Shows the consent form to the user and returns the updated ConsentInformation.

Callers should handle FormExceptions.

Implementation

Future<ConsentInformation> showConsentForm() async {
  try {
    return await _channel
        .invokeMethod<Map>('showConsentForm')
        .then((it) => it!.cast<String, String>())
        .then(_parseConsentInformation);
  } on PlatformException catch (exception) {
    if (exception.code == _unknownErrorCode) {
      rethrow;
    }

    final code = _enumFromString(FormErrorCode.values, exception.code);
    if (code == null) {
      rethrow;
    }

    throw FormException(
      message: exception.message!,
      code: code,
      originalException: exception,
    );
  }
}