DiscoveryTip<E extends Object> class
A single feature-discovery entry. Parameterized on E — the consumer-
defined event type (typically an enum) used to match triggers.
Example:
enum AppEvent { onStartupTick, onProductViewed }
DiscoveryTip<AppEvent>(
id: 'welcome_banner',
priority: DiscoveryPriority.standard,
triggers: {AppEvent.onStartupTick},
shouldShow: (ctx) async => ctx.appLaunches >= 2,
presentation: BannerPresentation(
title: 'Welcome back!',
body: 'Tap the star icon to favorite a product.',
cardColor: Colors.white,
accentColor: Colors.indigo,
),
);
Constructors
-
DiscoveryTip({required String id, required DiscoveryPriority priority, required Set<
E> triggers, required Future<bool> shouldShow(DiscoveryContext ctx), required DiscoveryPresentation presentation, int order = 100, bool oneShot = true}) -
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable id used by TipLedger to remember whether the tip has been seen.
final
- oneShot → bool
-
If true, the tip is skipped once
ledger.hasSeen(id)is true.final - order → int
-
Sort key within a single priority bucket (lower = earlier).
final
- presentation → DiscoveryPresentation
-
How to render the tip when it wins.
final
- priority → DiscoveryPriority
-
Evaluation priority. See DiscoveryPriority.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shouldShow
→ Future<
bool> Function(DiscoveryContext ctx) -
Eligibility check run after the ledger and session gates pass. Return
falseto skip this tip for the current emit without marking it seen.final -
triggers
→ Set<
E> -
Events that trigger evaluation of this tip.
final
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