This package allows you to manage agreements with users. It allows you to display the latest versions of agreements, see which agreements a user has approved, and record the approval of an agreement.

Features

  • Display the latest versions of agreements
  • See which agreements a user has approved
  • Record the approval of an agreement

Getting started

Add the IWS API key as a DART variable at compile time:

--dart-define=IWS_API_KEY=xxxxxxxxxxxxxx

Usage

Display the latest versions of agreements:

final agreements = await IwsAgreements().getAllAgreements();

See which agreements a user has approved:

final agreements = await IwsAgreements().getAcceptedAgreements('user_id');

See which agreements are pending for a user to accept:

final agreements = await IwsAgreements().getPendingAgreements('user_id', onlyWithRequiredAcceptance: true);

Get the latest version of an agreement:

final agreement = await IwsAgreements().getAgreement('agreement_name');

Record the approval of an agreement:

await IwsAgreements().acceptAgreement('agreement_name', userIdentifier: 'user_id');

Record the approval of many agreements:

await IwsAgreements().acceptAgreements(['agreement_name1', 'agreement_name2'], userIdentifier: 'user_id');

Libraries

iws_agreements