appendFrom method

void appendFrom(
  1. MessageBuilder builder
)

Appends all components from another builder to the end of this one.

This is useful for composing messages from reusable parts or combining multiple builder instances.

Example:

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

final footer = MessageBuilder()
  ..addSeparator()
  ..addText('Thank you for reading!');

final message = MessageBuilder()
  ..appendFrom(header)
  ..addText('Main content here')
  ..appendFrom(footer);

See also:

  • prependFrom to add components at the beginning
  • copyWith to create a new builder with combined components

Implementation

void appendFrom(MessageBuilder builder) {
  _components.addAll(builder._components);
}