WidgetService class
Constructors
- WidgetService({required String baseUrl, Client? client, WidgetCache? cache})
Properties
- baseUrl → String
-
final
- cache → WidgetCache?
-
Optional offline cache. When provided, successful responses are stored
locally and returned if a subsequent network request fails.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dismissWidget(
String widgetId, String userId) → Future< void> - Dismiss a widget for a user.
-
dispose(
) → void -
evaluateTriggers(
TriggerContext context) → Future< List< WidgetEntry> > - Evaluate triggers and get matching widgets.
-
getWidgets(
{String? userId}) → Future< List< WidgetEntry> > - Fetch all widgets, optionally filtered by user.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordInteraction(
String widgetId, String userId, {String action = 'tap'}) → Future< void> - Record a widget interaction.
-
recordUserAction(
String userId, String action, {Map< String, dynamic> ? metadata}) → Future<void> - Record a user action for trigger evaluation.
-
suggestWidgets(
Map< String, dynamic> context) → Future<WidgetResponse> - Ask AI to suggest widgets for a context.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited