admob_consent 1.1.2 copy "admob_consent: ^1.1.2" to clipboard
admob_consent: ^1.1.2 copied to clipboard

A wrapper for Google's User Messaging Platform (UMP) SDK, used for consent gathering (i.e. GDPR, ATT) on Android and iOS.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:admob_consent/admob_consent.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  AdmobConsent _admobConsent = AdmobConsent();
  StreamSubscription<void> _subscription;

  @override
  void initState() {
    super.initState();
    _subscription = _admobConsent.onConsentFormObtained.listen((o) {
      // Obtained consent
    });
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    _admobConsent.show();
  }

  @override
  void dispose() {
    _subscription.cancel();
    _admobConsent.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('An example app'),
        ),
      ),
    );
  }
}
19
likes
40
pub points
69%
popularity

Publisher

verified publisheranteger.com

A wrapper for Google's User Messaging Platform (UMP) SDK, used for consent gathering (i.e. GDPR, ATT) on Android and iOS.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on admob_consent