insertAllMessages abstract method
Inserts a list of messages into the chat, starting at the specified index.
The index refers to the position in the underlying content list where the
first message in the messages list should be inserted. Subsequent messages
in the list will follow sequentially.
- Use this for batch insertions, like loading a page of older messages or adding multiple new messages at once.
- The controller should emit a
ChatOperation.insertAll(messages, index)to notify listeners. - Note: For simpler persistence layers (e.g., basic key-value stores) that
don't inherently support ordered list insertions at an arbitrary index,
ensuring that a subsequent call to
this.messagesreflects the correct logical order after an indexedinsertAllMessagesoperation might require storing and sorting by an explicit order field (e.g., a createdAt or a sequence number) within the controller's implementation.
Implementation
Future<void> insertAllMessages(List<Message> messages, {int? index});