parseMainAxisAlignment method

MainAxisAlignment parseMainAxisAlignment(
  1. Token name
)

Implementation

MainAxisAlignment parseMainAxisAlignment(Token name) {
  consume(TokenType.leftParen, "Expect '(' after EdgeInsets method.");
  MainAxisAlignment result;
  switch (name.lexeme) {
    case 'MainAxisAlignmentStart':
      result = const MainAxisAlignmentStart();
      break;
    case 'MainAxisAlignmentCenter':
      result = const MainAxisAlignmentCenter();
      break;
    case 'MainAxisAlignmentEnd':
      result = const MainAxisAlignmentEnd();
      break;
    case 'MainAxisAlignmentSpaceBetween':
      result = const MainAxisAlignmentSpaceBetween();
      break;
    case 'MainAxisAlignmentSpaceAround':
      result = const MainAxisAlignmentSpaceAround();
      break;
    case 'MainAxisAlignmentSpaceEvenly':
      result = const MainAxisAlignmentSpaceEvenly();
      break;
    default:
      throw error(name, "Unknown MainAxisAligment method: ${name.lexeme}");
  }

  consume(TokenType.rightParen, "Expect ')' after EdgeInsets method.");
  return result;
}