StringInterpolationImpl constructor

StringInterpolationImpl({
  1. required List<InterpolationElementImpl> elements,
})

Initialize a newly created string interpolation expression.

Implementation

StringInterpolationImpl({
  required List<InterpolationElementImpl> elements,
}) {
  // TODO(scheglov) Replace asserts with appropriately typed parameters.
  assert(elements.length > 2, 'Expected at last three elements.');
  assert(
    elements.first is InterpolationStringImpl,
    'The first element must be a string.',
  );
  assert(
    elements[1] is InterpolationExpressionImpl,
    'The second element must be an expression.',
  );
  assert(
    elements.last is InterpolationStringImpl,
    'The last element must be a string.',
  );
  _elements._initialize(this, elements);
}