Share Kit Flutter

Share Kit Flutter

Flutter implementation of Share Kit

Usage

Check example for complete examples.

import 'package:bloom_share_kit/bloom_share_kit.dart';

final requestData = RequestData(...)
final buttonCallbackUrl = '...'

RequestButton(
  requestData: requestData,
  buttonCallbackUrl: buttonCallbackUrl,
)

RequestData

NameDescriptionType
actionAction typeAction
tokenUnique string to identify this data requeststring
urlThe API endpoint to POST the ResponseData to.<br/> See below for detailsstring
org_logo_urlA url of the logo to display to the user when requesting datastring
org_nameThe name of the organization requesting datastring
typesThe type of attestions required and the amount neededAttestationTypeID
org_usage_policy_urlThe url of the usage policy for the organization requesting datastring
org_privacy_policy_urlThe url of the privacy policy for the organization requesting datastring

AttestationTypeID

See share-kit for a complete list of supported attestation types.

Appending to URL

The user can share by tapping a button or scanning a QR code, sometimes you'll need to know the difference so the query param share-kit-from is appended to your url.

The param will either be share-kit-from=qr OR share-kit-from=button.

// Input
'https://receive-kit.bloom.co/api/receive'

// Output
'https://receive-kit.bloom.co/api/receive?share-kit-from=qr'

Works if your url already has a query param too!

// Input
'https://receive-kit.bloom.co/api/receive?my-param=',

// Output
'https://receive-kit.bloom.co/api/receive?my-param=&share-kit-from=qr',

Button Callback URL

The buttonCallbackUrl parameter will be used to send the user back to your app after they share their data.

Example

import 'package:bloom_share_kit/bloom_share_kit.dart';

final requestData = RequestData(
  action: Action.request_attestation_data,
  token: 'a08714b92346a1bba4262ed575d23de3ff3e6b5480ad0e1c82c011bab0411fdf',
  url: 'https://receive-kit.bloom.co/api/receive',
  org_logo_url: 'https://bloom.co/images/notif/bloom-logo.png',
  org_name: 'Bloom',
  org_usage_policy_url: 'https://bloom.co/legal/terms',
  org_privacy_policy_url: 'https://bloom.co/legal/privacy',
  types: [AttestationTypeID.phone, AttestationTypeID.email],
)

RequestButton(
  requestData: requestData,
  buttonCallbackUrl: 'https://mysite.com/bloom-callback',
)

Sample Button

Response

For validating the reponse on your server see share-kit

Testing

Run

flutter test

Libraries

bloom_share_kit