parseEdgeInsets method

EdgeInsets parseEdgeInsets(
  1. Token name
)

Implementation

EdgeInsets parseEdgeInsets(Token name) {
  final parameters = _parseParameterNodes();

  EdgeInsets result;
  switch (name.lexeme) {
    case 'EdgeInsetsAll':
      result = EdgeInsetsAll(parameters['value']!);
      break;
    case 'EdgeInsetsSymmetric':
      result = EdgeInsetsSymmetric(
          parameters['horizontal'], parameters['vertical']);
      break;
    case 'EdgeInsetsOnly':
      result = EdgeInsetsOnly(parameters['top'], parameters['right'],
          parameters['bottom'], parameters['left']);
      break;
    default:
      throw error(name, "Unknown EdgeInsets method: ${name.lexeme}");
  }

  return result;
}