WonderPush class
The WonderPush SDK main class.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
addProperty(
String property, dynamic value) → Future< void> -
Adds the
value
to a givenproperty
associated to this installation.value
can be a list or an individual value. The stored value is made an array if not already one. If the given value is an array, all its values are added. If a value is already present in the stored value, it won’t be added. -
addTag(
dynamic tags) → Future< void> -
Adds one or more tags to this installation.
tags
can be a list or a string. -
clearAllData(
) → Future< void> - Instructs to delete any event, installation and potential user objects associated with all installations present on the device, locally and on WonderPush servers. See https://docs.wonderpush.com/docs/gdpr-compliance#giving-users-control-over-their-data
-
clearEventsHistory(
) → Future< void> - Instructs to delete any event associated with the all installations present on the device, locally and on WonderPush servers. See https://docs.wonderpush.com/docs/gdpr-compliance#giving-users-control-over-their-data
-
clearPreferences(
) → Future< void> - Instructs to delete any custom data (including installation properties) associated with the all installations present on the device, locally and on WonderPush servers. See https://docs.wonderpush.com/docs/gdpr-compliance#giving-users-control-over-their-data
-
disableGeolocation(
) → Future< void> - Disables the collection of the user's geolocation.
-
downloadAllData(
) → Future< void> - Initiates the download of all the WonderPush data relative to the current installation and opens a user interface to let users use it as they wish.
-
enableGeolocation(
) → Future< void> - Enables the collection of the user's geolocation. You still need the appropriate geolocation permissions in your AndroidManifest.xml for Android and Info.plist for iOS to be able to read the user's location.
-
getAccessToken(
) → Future< String?> - Returns the accessToken
-
getCountry(
) → Future< String?> - Returns the user's country, either as previously stored, or as guessed from the system.
-
getCurrency(
) → Future< String?> - Returns the user's currency, either as previously stored, or as guessed from the system.
-
getDeviceId(
) → Future< String?> - Returns the deviceId
-
getInstallationId(
) → Future< String?> - Returns the installationId, or null if the WonderPush servers have not been contacted just yet.
-
getLocale(
) → Future< String?> - Returns the user's locale, either as previously stored, or as guessed from the system.
-
getProperties(
) → Future< Object> - Returns an object containing the properties of the current installation.
-
getPropertyValue(
String property) → Future -
Returns the value of a given
property
associated to this installation. If the property stores an array, only the first value is returned. This way you don’t have to deal with potential arrays if that property is not supposed to hold one. Returns null if the property is absent or has an empty array value. -
getPropertyValues(
String property) → Future< List> - Returns an list of the values of a given property associated to this installation. If the property does not store an array, an array is returned nevertheless. This way you don’t have to deal with potential scalar values if that property is supposed to hold an array. Returns an empty array if the property is absent or null. Returns an array wrapping any scalar value held by the property.
-
getPushToken(
) → Future< String?> - Returns the push token of this installation, or null.
-
getTags(
) → Future< List> - Returns a list of tags associated with the current installation.
-
getTimeZone(
) → Future< String?> - Returns the user's time zone, either as previously stored, or as guessed from the system.
-
getUserConsent(
) → Future< bool?> - Returns the userConsent
-
getUserId(
) → Future< String?> - Returns the userId you've assigned to this installation, or null. See User IDs.
-
hasTag(
String tag) → Future< bool> -
Tells whether the current installation as a tag
tag
. -
isSubscribedToNotifications(
) → Future< bool> - Tells whether user is subscribed to push notifications.
-
putProperties(
Object properties) → Future< void> -
Updates the
properties
of the current installation. Omitting a previously set property leaves it untouched. To remove a property, you must pass it explicitly with a value of null. -
removeAllTags(
) → Future< void> - Removes all tags.
-
removeProperty(
String property, Object value) → Future< void> -
Removes the value from a given
property
associated to the current installation. Ifvalue
is a list, all its values are removed. If a value is present multiple times in the stored value, they will all be removed. -
removeTag(
dynamic tags) → Future< void> -
Removes one or more tags to this installation.
tags
can be a list or a string. -
setCountry(
String country) → Future< void> -
Overrides the user's
country
. Defaults to getting the country code from the system default locale. You should use an ISO 3166-1 alpha-2 country code, eg: US, FR, GB. Use null to disable the override. -
setCurrency(
String currency) → Future< void> -
Overrides the user's
currency
. Defaults to getting the currency code from the system default locale. You should use an ISO 4217 currency code, eg: USD, EUR, GBP. Use null to disable the override. -
setDelegate(
WonderPushDelegate delegate) → void -
setGeolocation(
double lat, double lon) → Future< void> - Overrides the user's geolocation. Lets you set the user's location you've collected yourself. Calling this method with null has the same effect as calling disableGeolocation.
-
setLocale(
String locale) → Future< void> -
Overrides the user's
locale
. Defaults to getting the language and country codes from the system default locale. You should use an xx-XX form of RFC 1766, composed of a lowercase ISO 639-1 language code, an underscore or a dash, and an uppercase ISO 3166-1 alpha-2 country code. -
setLogging(
bool enable) → Future< void> - Enables or disables verbose logging of WonderPush.
-
setProperty(
String property, Object? value) → Future< void> -
Sets the
value
to a givenproperty
associated to the current installation. The previous value is replaced entirely. Thevalue
can be a string, number, object, list or null (which has the same effect as unsetProperty). See format of property names for detailed syntax. -
setRequiresUserConsent(
bool isConsent) → Future< void> - Sets whether user consent is required before the SDK takes any action. See https://docs.wonderpush.com/docs/gdpr-compliance#section-declaring-that-consent-is-required By default, user consent is not required. Note that the value is not remembered between runs, it is rather a mode that you enable.
-
setTimeZone(
String timeZone) → Future< void> -
Overrides the user's
timeZone
. Defaults to getting the time zone code from the system default locale. You should use an IANA time zone database codes, Continent/Country style preferably like Europe/Paris, or abbreviations like CET, PST, UTC, which have the drawback of changing on daylight saving transitions. Use null to disable the override. -
setUserConsent(
bool consentGiven) → Future< void> -
Sets user privacy consent according to
consentGiven
. Works in conjunction with the setRequiresUserConsent method. If user consent is required, the SDK takes no action until user consent it provided by calling setUserConsent(true). Calling setUserConsent(false) blocks the SDK again. -
setUserId(
String userId) → Future< void> - Assigns your own user ID to an installation. See User IDs.
-
subscribeToNotifications(
[bool fallbackToSettings = false]) → Future< void> - Prompts user to subscribe to push notifications on iOS, subscribes the user directly on Android.
-
trackEvent(
String type, [Object? attributes]) → Future< void> -
Sends an event with of type
type
andattributes
of your choice. -
unsetProperty(
String property) → Future< void> - Removes the value of a given property associated to the current installation.
-
unsubscribeFromNotifications(
) → Future< void> - Unsubscribes user from push notifications.