showCaptcha method
Shows the captcha widget in the chosen mode.
onSuccess is called when the captcha is solved with a valid token.
onError is called when captcha fails or closes without solving.
Implementation
Future<String?> showCaptcha({
required BuildContext context,
required CaptchaParams params,
}) async {
String? token;
switch (params.mode) {
case CaptchaType.screen:
token = await _showAsScreen(context);
case CaptchaType.dialog:
token = await _showAsDialog(context);
case CaptchaType.modalBottomSheet:
token = await _showAsBottomSheet(context);
case CaptchaType.responsiveDialog:
token = await _showAsResponsiveDialog(context);
}
if (token != null) {
params.onSuccess(token);
} else {
params.onError(onErrorMessage);
}
return token;
}