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

Piano Consents SDK for Flutter


Piano Consents SDK for Flutter

Getting Started #

  1. Add this to your pubspec.yaml file:

    dependencies:
      piano_consents: ^1.0.0
    
  2. Install the plugin using the command

    flutter pub get
    

Usage #

Important: Initialize PianoConsents before initializing other Piano plugins

  1. 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();
        ...
      }
      ...
    }
    
  2. Set consents

    await _pianoConsents.set(
      purpose: PianoConsentPurpose.audienceMeasurement,
      mode: PianoConsentMode.essential,
      products: [PianoConsentProduct.pa]);
    
  3. Set all consents

    await _pianoConsents.setAll(mode: PianoConsentMode.essential);
    
  4. Set default consents

    await _pianoConsents.clear();
    
0
likes
140
points
1.33k
downloads

Publisher

verified publisherpiano.io

Weekly Downloads

Piano Consents SDK for Flutter

Repository (GitLab)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on piano_consents