consent_receipt_dart 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

consent-receipt-dart #

Build Status Pub

Dart library for working with Kantara Initiative Consent Receipts.

Implements KI-CR-v1.1.0 of the consent receipt specification.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

License #

Licensed under the terms of the Apache 2.0 license, the full version of which can be found in the LICENSE file included in the distribution.

0.0.1 #

  • Initial version - compliant with KI-CR-v1.1.0


import 'dart:convert';
import 'dart:io';
import 'package:consent_receipt_dart/consent_receipt_dart.dart';

JsonDecoder decoder = JsonDecoder();
JsonEncoder encoder = JsonEncoder.withIndent('  ');

void prettyPrintJson(String input) {
  var object = decoder.convert(input);
  var prettyString = encoder.convert(object);
  prettyString.split('\n').forEach((element) => print(element));

main() {
  final DataController dataController = DataController(
    piiController: 'Adaptant Solutions AG',
    onBehalf: true,
    contact: 'Max Musterman',
    address: PostalAddress(
      addressCountry: 'DE',
      addressLocality: 'Deisenhofen',
      addressRegion: 'BY',
      postalCode: '82041',
      streetAddress: 'Bahnhofstr. 36',
    email: '',
    phone: '49-89-904101300',
    piiControllerURL: '',

  ConsentReceiptGenerator generator = ConsentReceiptGenerator(
    countryCode: 'DE',
    privacyPolicy: '',
    piiControllers: [dataController],

  Service defaultService = Service(
    purposes: [
        purpose: "To provide contracted services",
        purposeCategory: PurposeSpecification.ContractedService,
        primaryPurpose: true,
        termination: "Subscription end date + 1 year",
        thirdPartyDisclosure: false,
        piiCategory: [
    service: "default service name",

  final consentReceipt = generator.generateConsentReceipt(
    collectionMethod: 'web form',
    subjectId: '',
    sensitiveData: [
    services: [

  final jsonStr = consentReceiptToJson(consentReceipt);

  // Write to file

  // Now read
  final data = File('sample-cr.json').readAsStringSync();
  final cr = consentReceiptFromJson(data);



  if (consentReceipt.consentReceiptID == cr.consentReceiptID) {
    print("Parsing succeeded");
  } else {
    print("Something went wrong");

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  consent_receipt_dart: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:consent_receipt_dart/consent_receipt_dart.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:consent_receipt_dart/consent_receipt_dart.dart.

Health issues and suggestions

Document public APIs. (-0.72 points)

107 out of 108 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0-dev.7.0 <3.0.0
alpha2_countries ^1.0.5 1.0.5
meta ^1.1.7 1.1.8
uuid ^2.0.2 2.0.4
validators ^2.0.0+1 2.0.0+1
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
typed_data 1.1.6
Dev dependencies
pedantic ^1.8.0
test ^1.6.0