build method

String build()

Build the final context string.

Implementation

String build() {
  // Sort by priority
  final sorted = List<ContextItem>.from(_items)
    ..sort((a, b) => a.priority.index.compareTo(b.priority.index));

  return sorted.map((item) => item.content).join('\n\n');
}