SuggestionBarController class

Drives the "suggestion bar" surface (chips above the chat list of users the local user is likely to message). Merges two discovery sources:

  1. Roster — every entry in client.contacts.list(). Filters out self, blocked users and globally-deactivated rows. Display names are resolved through adapter.displayNameFor so cached users surface a friendly label instead of their raw id.
  2. Demo / well-known names — when demoDisplayNames is non-empty, each name is looked up via client.users.search(name) and matched by exact display name. Useful for harness flows or "pinned demo contacts" without sharing a prefix on the user id.

Exposes a ChangeNotifier so the host wraps it in a ListenableBuilder and gets free rebuilds as suggestions land. Auto- refresh is opt-in via startAutoRefresh / stopAutoRefresh — typically 10s in demo flows so a peer who logs in AFTER the current session still shows up without manual action.

Inheritance

Constructors

SuggestionBarController(ChatUiAdapter _adapter, {List<String> demoDisplayNames = const [], bool discoverAll = false, void onError(String label, Object? error)?})

Properties

demoDisplayNames List<String>
Display names polled via users.search. Empty when only roster drives suggestions.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isLoading bool
true while a fetch is in flight.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
suggestions List<SuggestedContact>
Current snapshot. Updated atomically per load() call.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
load() Future<void>
Fetches roster + demo discovery and updates suggestions. Safe to call repeatedly; concurrent calls coalesce.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setStatic(List<SuggestedContact> suggestions) → void
Sets a static list of suggestions and stops any polling. Useful for mock mode where the suggestion bar is fixed up front.
startAutoRefresh({Duration interval = RoomDefaults.suggestionPollInterval}) → void
Starts polling load on interval. Cancels any previous timer. Default interval is RoomDefaults.suggestionPollInterval.
stopAutoRefresh() → void
Cancels the periodic refresh timer. Idempotent.
toString() String
A string representation of this object.
inherited

Operators

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