FrequencyCap class

Frequency cap to limit how often an ad can be shown.

Enforces a minimum interval between consecutive ad impressions to avoid annoying users.

Constructors

FrequencyCap({required int intervalSeconds})
Creates a frequency cap with the given intervalSeconds.

Properties

canShow bool
Whether enough time has elapsed since the last impression.
no setter
hashCode int
The hash code for this object.
no setterinherited
intervalSeconds int
Minimum interval between impressions, in seconds.
final
lastShowTime DateTime?
The time of the last impression, if any.
no setter
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
recordImpression() → void
Records that an ad was shown at the current time.
recordImpressionAt(DateTime time) → void
Records an impression at a specific time (for testing).
reset() → void
Resets the frequency cap (clears the last show time).
toString() String
A string representation of this object.
inherited

Operators

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