getDelimeter function

String getDelimeter(
  1. int length, {
  2. String title = '',
})

Implementation

String getDelimeter(int length, {String title = ''}) {
  title = title.trim().isNotEmpty ? ' ${title.trim()} ' : title;
  length = max(length, title.length);
  length = title.length.isEven ? length : length + 1;
  final delimeter = '=' * length;
  final start = (length - title.length) ~/ 2;
  final end = (length + title.length) ~/ 2;
  return delimeter.replaceRange(start, end, title);
}