ContextSdk class

Constructors

ContextSdk()

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

calibrate(String flowName, ValueSetter<RealWorldContext> onContextReady, {int? maxDelay, Map<String, dynamic>? customSignals}) → void
fetchContext(String flowName, int duration, {Map<String, dynamic>? customSignals}) Future<RealWorldContext>
Get the current context asynchronously. ContextSDK will automatically figure out, if a context object can be generated immediately (in that case, your callback is instantly executed), or if it needs to run for a little while, until it's ready to execute your callback. The callback will be excuted on the main thread.
getSDKVersion() Future<String>
instantContext(String flowName, int duration, {Map<String, dynamic>? customSignals}) Future<RealWorldContext>
Get the current context synchronously. The signal may not include all the information, if the duration wasn't reached. Be sure that the majority of the times when calling this method, the SDK has already had enough time to reach the duration you've set.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optimize(String flowName, ValueSetter<RealWorldContext> onGoodMoment, {int? maxDelay, Map<String, dynamic>? customSignals}) → void
Call this method to obtain a context for the given flow name. By default the callback will operate in calibration mode and always be called asynchronously within in 3 seconds (or sooner if the app has already been running for more than 3 seconds) Once a custom model has been created for a flow the callback will only be called if ContextSDK determined it to be a good moment, otherwise this method will simply do nothing, and your callback will not be invoked
recentContext(String flowName) Future<RealWorldContext?>
Fetch the most recently generated Context for a given flowName. Will be null if there is no recent context.
setGlobalCustomSignals(Map<String, dynamic> customSignals) Future<void>
Set custom signals that will be used for all ContextSDK events on this instance. We recommend using this to provide generic information that's applicable to all calls, like any AB test information, or other data that may be relevant to calculate the likelihood of an event. Please be sure to not include any PII or other potentially sensitive information. You can overwrite values by using the same key again, and remove them by setting them to null.
setup(String licenseKey) Future<bool>
Call this once right at the app start.
toString() String
A string representation of this object.
inherited
trackEvent(String eventName, Map<String, dynamic> customSignals) Future<void>
Call this method to track a generic event. Using this allows us to provide you with insights on how your app behaves in the real-world context
trackPageView(String pageName, Map<String, dynamic> customSignals) Future<void>
Call this method to track a generic page view. Using this allows us to provide you with insights on how your app behaves in the real-world context
trackUserAction(String actionName, Map<String, dynamic> customSignals) Future<void>
Call this method to track a generic user action. Using this allows us to provide you with insights on how your app behaves in the real-world context

Operators

operator ==(Object other) bool
The equality operator.
inherited