EscapeSequence constructor

EscapeSequence(
  1. String finalChars,
  2. {String prefix = '',
  3. Iterable<int> parameters = const [],
  4. Iterable<int> defaults = const []}
)

Creates a new escape sequence.

If defaults is provided, they are used when computing toEscapedString output if verbose: false, and are excluded from the output if they are the same as the parameters. Must be the same length as parameters if provided.

Implementation

factory EscapeSequence(
  String finalChars, {
  String prefix = '',
  Iterable<int> parameters = const [],
  Iterable<int> defaults = const [],
}) {
  if (defaults.isNotEmpty && parameters.length != defaults.length) {
    throw ArgumentError.value(
      defaults,
      'defaultParameters',
      'must have the same length as parameters',
    );
  }
  return _EscapeSequence(
    finalChars,
    prefix: prefix,
    parameters: parameters,
    defaults: defaults,
  );
}