getDelimetedSection function

String getDelimetedSection(
  1. String message,
  2. int delimeterLength, {
  3. String title = '',
})

Implementation

String getDelimetedSection(
  String message,
  int delimeterLength, {
  String title = '',
}) {
  final maxPart = message.split('\n').map((e) => e.length).fold(0, max);
  delimeterLength = max(delimeterLength, maxPart);

  final top = getDelimeter(delimeterLength, title: title);
  final bottom = getDelimeter(top.length);

  return [
    top,
    message,
    bottom,
  ].join('\n');
}