Skip to content

Preferences

Your team gives the app topics on Settings › Audience › Topics, such as “Offers” and “New arrivals”, each going by some of email, push, in the app and chat. A person hears about a topic by a channel only when they are subscribed to it: their own choice, or the topic’s default when they never chose. Consent and topics explains the whole model.

PurrCRM‘s emails link to a preference page on the web. In your app, give people the package’s screen.

It is behind no part: anyone signed in may open it.

CrmRow(
title: 'Offers and news',
onTap: () => context.push(CrmLinks.preferences), // or crm.show(CrmDestination.preferences)
);
// Or mount it yourself:
crm.preferencesScreen(onExit: () => Navigator.of(context).pop());

Each switch is kept as it is turned, with the wording it was agreed under (the package’s own words; pass your own wording to CrmPreferencesScreen if you change them). “Unsubscribe from all offers and news” turns every channel off. Topics show in the person’s language where your team translated them.

Read and change the same choices yourself:

final prefs = await crm.preferences(); // null when PurrCRM could not be reached
await crm.setPreferences([
CrmPreferenceChoice(
topicId: prefs!.topics.first.id,
channel: CrmPreferenceChannel.email,
subscribed: false,
),
]);

Both answer null when PurrCRM could not be reached. crm.setOffersByPush is the push channel’s own switch, above every topic (Push).

The models are in the reference: Models: preferences.