MorphSuggestion class

A single, fully-formed suggestion ready to render in the MorphSuggestionCard. Built by SuggestionEngine — devs don't instantiate these directly.

The _action is opaque to the dev: it's a closure the engine assembles (e.g. Navigator.pushNamed, zoneReorder.apply, dev-provided callback).

Annotations

Constructors

MorphSuggestion({required String id, required SuggestionType type, required String title, required String description, required String actionLabel, String dismissLabel = 'Not now', required double confidence, Map<String, dynamic> metadata = const {}, Future<void> action()?})
const

Properties

actionLabel String
final
confidence double
0..1 — confidence the engine has in this suggestion, used to pick the best candidate when several are eligible at the same tick.
final
description String
final
dismissLabel String
final
hashCode int
The hash code for this object.
no setterinherited
id String
Stable identifier, used as the key in SuggestionHistoryStore. Must be deterministic so the same scenario always produces the same id (otherwise the cooldown rules can't track it).
final
metadata Map<String, dynamic>
Free-form metadata captured when the suggestion was built (target page, zone id, etc.). Available to the action closure via the engine that built it.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String
final
type SuggestionType
final

Methods

execute() Future<void>
Runs the engine-supplied action (no-op when no action was set, e.g. for tests).
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