runAsyncForMessage method

void runAsyncForMessage(
  1. String? messageId,
  2. Future<void> action()
)

Runs the async action only if the message ID is different from the last processed one.

Implementation

void runAsyncForMessage(String? messageId, Future<void> Function() action) {
  if (messageId == null || messageId != _lastMessageId) {
    _lastMessageId = messageId;
    runAsync(action);
  }
}