piano_consents 1.0.0
piano_consents: ^1.0.0 copied to clipboard
Piano Consents SDK for Flutter
Piano Consents SDK for Flutter
Getting Started #
-
Add this to your pubspec.yaml file:
dependencies: piano_consents: ^1.0.0
-
Install the plugin using the command
flutter pub get
Usage #
Important: Initialize PianoConsents before initializing other Piano plugins
-
Initialize PianoConsents
import 'package:piano_consents/piano_consents.dart'; ... class _MyAppState extends State<MyApp> { final _pianoConsents = PianoConsents( requireConsents: true, defaultPurposes: { PianoConsentProduct.pa: PianoConsentPurpose.audienceMeasurement } ); @override void initState() { super.initState(); initPlugins(); } Future<void> initPlugins() async { ... await _pianoConsents.init(); ... } ... }
-
Set consents
await _pianoConsents.set( purpose: PianoConsentPurpose.audienceMeasurement, mode: PianoConsentMode.essential, products: [PianoConsentProduct.pa]);
-
Set all consents
await _pianoConsents.setAll(mode: PianoConsentMode.essential);
-
Set default consents
await _pianoConsents.clear();