flutter_consent_flow 1.0.0 copy "flutter_consent_flow: ^1.0.0" to clipboard
flutter_consent_flow: ^1.0.0 copied to clipboard

outdated

A Flutter utility library for handling regulatory frameworks and geolocation permissions. This library provides methods to identify the relevant regulatory framework based on the user's IP or location [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_consent_flow/flutter_consent_flow.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Consent Flow',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            FilledButton(
              onPressed: () async {
                final RegulatoryFramework? regulatoryFramework =
                    await FlutterConsentFlow.getRegulatoryFrameworkByIP(
                  apiKey: 'YOUR_API_KEY',
                  ifFailed: () {
                    debugPrint('UNABLE TO FIND `RegulatoryFramework`');

                    /// handle if task failed
                  },
                );
                if (regulatoryFramework == null) return;
                if (context.mounted) {
                  /// handle consent
                  final bool? hasConsent = await showDialog(
                    context: context,
                    builder: (_) => FlutterConsentDialog(
                      regulatoryFramework: regulatoryFramework,
                      appIcon: const AssetImage('YOUR_APP_ICON'),
                      appName: 'YOUR_APP_NAME',
                      privacyPolicyLink: 'YOUR_PRIVACY_POLICY_URL',
                    ),
                  );
                }
              },
              child: const Text('Check & Request'),
            )
          ],
        ),
      ),
    );
  }
}
3
likes
0
points
50
downloads

Publisher

verified publisherinfoowly.com

Weekly Downloads

A Flutter utility library for handling regulatory frameworks and geolocation permissions. This library provides methods to identify the relevant regulatory framework based on the user's IP or location and show a consent dialog to request user consent.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, geocoding, geolocator, http, url_launcher

More

Packages that depend on flutter_consent_flow