ClikgateFake class

A fake Clikgate for widget and unit tests: see ClikgateFake.install.

Defaults: configure succeeds; getInstallationId and getInstallationHeader return installationId and Clikgate-Installation: <appId>:<installationId>; goal answers goalStatus (counted), and Payment goals (with a provider) paymentGoalStatus (waiting); isFeatureEnabled reads features; referrals.applyCode succeeds unless applyCodeError is set; attribution is attribution (organic); Engage referrals.createLink returns a link with referralCode; share calls open nothing and are recorded in shares. Change any of these on the fake at any time.

Properties

appId ↔ String
The Clikgate app ID in the installation header: app_ and a 26-character ULID.
getter/setter pair
appliedCodes → List<ClikgateFakeAppliedCode>
Clikgate.referrals.applyCode calls (failed ones too).
final
applyCodeError ↔ String?
When set, Clikgate.referrals.applyCode throws ClikgateException with this code (code_not_found, already_referred, self_referral, window_expired, ...; existing_user throws ExistingUserException).
getter/setter pair
attribution ↔ ClikgateAttribution
What Clikgate.getAttribution() returns.
getter/setter pair
calls → List<MethodCall>
Every platform-channel call, in order (com.clikgate/sdk and com.clikgate/engage).
final
configureArguments ↔ Map<String, Object?>?
The arguments of the last Clikgate.configure call, or null before it.
getter/setter pair
configured → bool
Whether Clikgate.configure was called.
no setter
createLinkError ↔ String?
When set, Engage referrals.createLink and myStats throw ClikgateException with this code (identity_required, program_paused, ...).
getter/setter pair
customerId → String?
The identified customer, as the native SDK would store it after the identifyUser calls.
no setter
engageRequests → List<ClikgateFakeRequest>
Requests the Engage features sent to the Clikgate API.
final
features → Map<String, bool>
Clikgate.isFeatureEnabled answers; unknown keys are off. The defaults are the SDK's before its first config fetch.
final
goals → List<ClikgateFakeGoal>
Clikgate.goal calls.
final
goalStatus ↔ GoalStatus
The status Clikgate.goal answers for a goal without a provider.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
identifyCalls → List<ClikgateFakeIdentify>
Clikgate.identifyUser calls.
final
identityToken → String?
The identity token stored with customerId.
no setter
installationId ↔ String?
What Clikgate.getInstallationId() returns. Null acts like tracking off (the installation header is null too).
getter/setter pair
linkDomain ↔ String
The link domain of fake links (https://<linkDomain>/r/<referralCode>), and the domain Clikgate.handleUrl treats as a Clikgate link.
getter/setter pair
onEngageRequest ↔ Response? Function(Request request)?
Answers an Engage request yourself: return a response, or null for the fake's default. For example (r) => r.url.path.endsWith('/referrals/me') ? http.Response('...', 200) : null.
getter/setter pair
onGoal ↔ GoalResult? Function(ClikgateFakeGoal goal)?
Overrides the goal answer: return a GoalResult for the goal, or null for the defaults.
getter/setter pair
paymentGoalStatus ↔ GoalStatus
The status Clikgate.goal answers for a Payment goal (one with a provider).
getter/setter pair
pushToken → String?
The push token from Clikgate.setPushToken, or null.
no setter
redeemError ↔ String?
When set, Engage codes.redeem throws ClikgateException with this code (code_not_found, code_expired, ...).
getter/setter pair
referralCode ↔ String
The code of the link Engage referrals.createLink returns.
getter/setter pair
referredBy ↔ Referral?
What Clikgate.referrals.referredBy() returns: null means not referred.
getter/setter pair
referrerDisplayName ↔ String
The referrer's name in the Referral that applyCode returns.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shareAppInstalled ↔ bool
Whether the app asked for in a share call (share.whatsApp, share.link(app: ...)) "opens"; false falls back to the share menu, as on a phone without that app.
getter/setter pair
shares → List<ClikgateFakeShare>
Engage share calls.
final
trackingEnabled → bool
False after Clikgate.setTrackingEnabled(false).
no setter

Methods

callsTo(String method) → List<MethodCall>
The calls of one channel method, such as setPushToken or referrals.referredBy.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushBrowserHandoff(String url) → void
Delivers a browser handoff on Clikgate.onBrowserHandoff (another organisation's link on a shared Clikgate domain).
Delivers a deep link on Clikgate.onDeepLink, as if the phone opened url (or, with isDeferred, as the deferred deep link after install). path defaults to the URL's path. Pump the widget tester afterwards so listeners run.
toString() → String
A string representation of this object.
inherited
uninstall() → void
Removes the fake (done for you when the test ends).

Operators

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

Static Methods

install({String? customerId, String? identityToken}) → ClikgateFake
Installs a fake for the current test and returns it. Call it in setUp or at the start of a test; it's removed when the test ends (addTearDown).