flutter_easy_recaptcha_v2 0.1.0 copy "flutter_easy_recaptcha_v2: ^0.1.0" to clipboard
flutter_easy_recaptcha_v2: ^0.1.0 copied to clipboard

A Flutter package that enables seamless integration of Google reCAPTCHA v2 into your app.

A Flutter package that enables seamless integration of Google reCAPTCHA v2 into your app. Version (0.1.0)

Demo #

DemoGIF

Getting started #

Add flutter_easy_recaptcha_v2 under your dependencies in the pubspec.yaml file.

 dependencies:
  flutter:
    sdk: flutter
  flutter_easy_recaptcha_v2: any

Import it to your Widget

import 'package:flutter_easy_recaptcha_v2/flutter_easy_recaptcha_v2.dart';

And enjoy adding reCAPTCHA v2 to your without the need for any external web page.

Configuration #

🤖 Android: Make sure to add android:usesCleartextTraffic="true" under android/app/src/main/AndroidManifest.xml

 <application
    android:usesCleartextTraffic="true"
    ... >

🍏 IOS: No configuration required

Usage #

 void _showRecaptchaBottomSheet(BuildContext context) {
    showModalBottomSheet(
      isDismissible: false,
      backgroundColor: Colors.white,
      isScrollControlled: true,
      context: context,
      builder: (BuildContext context) {
        return SizedBox(
          height: 700,
          child: Column(
            children: [
              Align(
                alignment: Alignment.topRight,
                child: IconButton(
                  icon: const Icon(
                    Icons.close,
                    weight: 20,
                  ),
                  onPressed: () => Navigator.pop(context),
                ),
              ),
              SizedBox(
                height: 600,
                child: RecaptchaV2(
                  // Your API Key
                  apiKey: "Your api key",
                  onVerifiedSuccessfully: (token) async {
                    log("Recaptcha token $token");
                    // It is recommended to verify the token on your server but you can also verify it here.
                    final bool isTokenVerified = await verifyRecaptchaV2Token(
                      token: token,
                      apiSecret: "Your api secret",
                    );
                    if (isTokenVerified) {
                      log("Token verified successfully");
                      // Implement your logic here
                    } else {
                      log("Token verification failed");
                      // Implement your logic here
                    }
                  },
                ),
              ),
            ],
          ),
        );
      },
    );
  }

Author #

Contact the developer : linkedin

22
likes
150
points
282
downloads

Publisher

verified publisherschooly.tn

Weekly Downloads

A Flutter package that enables seamless integration of Google reCAPTCHA v2 into your app.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_inappwebview, http

More

Packages that depend on flutter_easy_recaptcha_v2