parseAlignments method

List<String?> parseAlignments(
  1. String line
)

Implementation

List<String?> parseAlignments(String line) {
  line = line.replaceFirst(_openingPipe, '').replaceFirst(_closingPipe, '');
  return line.split('|').map((column) {
    column = column.trim();
    if (column.startsWith(':') && column.endsWith(':')) {
      return 'center';
    }
    if (column.startsWith(':')) {
      return 'left';
    }
    if (column.endsWith(':')) {
      return 'right';
    }
    return null;
  }).toList();
}