MockTeadsPrivacy class

A test double for TeadsPrivacyApi, with no MethodChannel involved.

Install with TeadsPrivacy.instance = MockTeadsPrivacy(); so every call through TeadsPrivacy's statics reaches this instead of the real native SDK. Every setter records the value it was last called with, so a test can assert on what was set; clearAllOverrides resets them all back to null, matching the real SDK putting itself back to reading storage.

A field reading null is ambiguous between "never called" and "called with null" (which is itself meaningful: it clears that one override). setCalls disambiguates — it records every setter invocation, in order, keyed by the same name used on the wire (e.g. 'gdprConsentStringV1'), so a test can assert a specific call happened even when its value was null.

Implemented types

Constructors

MockTeadsPrivacy()

Properties

clearAllOverridesCallCount ↔ int
getter/setter pair
gdprApplies ↔ bool?
getter/setter pair
gdprConsentStringV1 ↔ String?
getter/setter pair
gdprConsentStringV2 ↔ String?
getter/setter pair
gppSections ↔ String?
getter/setter pair
gppString ↔ String?
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
idfaTrackingAuthorized ↔ bool?
The value isIdfaTrackingAuthorized resolves to. null models Android, where there is no ATT/IDFA-authorization concept.
getter/setter pair
isIdfaTrackingAuthorized → Future<bool?>
Whether IDFA tracking is currently authorized — a read of the CURRENT state, never a prompt. iOS only; null on Android. See the implementation's doc comment for why this must never have a side effect.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
setCalls → List<MapEntry<String, Object?>>
Every setter call, in order, as (key, value) — see the class doc for why this exists alongside the plain fields above.
final
trackingAuthorizationResult ↔ bool?
The value requestTrackingAuthorization resolves to. null models Android, where there is no ATT prompt.
getter/setter pair
usPrivacyString ↔ String?
getter/setter pair

Methods

clearAllOverrides() → Future<void>
See TeadsPrivacy.clearAllOverrides.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestTrackingAuthorization() → Future<bool?>
Shows the iOS App Tracking Transparency prompt, resolving to whether the user authorised tracking. null on Android. See the implementation's doc comment for when to call it.
override
setGdprApplies(bool applies) → Future<void>
See TeadsPrivacy.setGdprApplies.
override
setGdprConsentStringV1(String? consentString) → Future<void>
See TeadsPrivacy.setGdprConsentStringV1.
override
setGdprConsentStringV2(String? consentString) → Future<void>
See TeadsPrivacy.setGdprConsentStringV2.
override
setGppSections(String? sections) → Future<void>
See TeadsPrivacy.setGppSections.
override
setGppString(String? gppString) → Future<void>
See TeadsPrivacy.setGppString.
override
setUsPrivacyString(String? privacyString) → Future<void>
See TeadsPrivacy.setUsPrivacyString.
override
toString() → String
A string representation of this object.
inherited

Operators

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