prependFrom method

void prependFrom(
  1. MessageBuilder builder
)

Prepends all components from another builder to the beginning of this one.

This is useful when you want to add a header or prefix to an existing message builder.

Example:

final header = MessageBuilder()
  ..addText('# Announcement')
  ..addSeparator();

final message = MessageBuilder()
  ..addText('Important content here');

message.prependFrom(header);
// message now has header content first, then the original content

See also:

  • appendFrom to add components at the end
  • copyWith to create a new builder instead of modifying this one

Implementation

void prependFrom(MessageBuilder builder) {
  _components.insertAll(0, builder._components);
}