dispatchSyncedMessages static method

Future<void> dispatchSyncedMessages(
  1. List<BaseMessage> fresh,
  2. List<BaseMessage> updated, {
  3. bool isCurrent()?,
})

Offline (E3): fans a reconnect catch-up page out to message listeners. Genuinely-new swept messages go through the normal per-type receive path; updates to already-cached messages go through the bulk onMessagesSynced. Both are decorated source == 'SYNC'. action/call are excluded by the caller. Invoked by the offline runtime after the page is persisted.

The returned future completes once every listener has been called; the sweep awaits it so all of them fire before onMessageSyncCompleted (BEH-SYNC-33). Each cache write is awaited before that message's listeners see it (BEH-INV-02).

isCurrent is checked before each message: once it is false (the sweep was aborted by a logout, a user switch or clearOfflineCache) nothing more is written or delivered (BEH-SYNC-06). A listener that throws is isolated: it never stops the other listeners, the later messages or the bulk callback.

Implementation

static Future<void> dispatchSyncedMessages(
  List<BaseMessage> fresh,
  List<BaseMessage> updated, {
  bool Function()? isCurrent,
}) => _dispatchSyncedMessages(fresh, updated, isCurrent ?? () => true);