highlightMultiple method Null safety

String highlightMultiple(
  1. String label,
  2. Map<SourceSpan, String> secondarySpans,
  3. {bool color = false,
  4. String? primaryColor,
  5. String? secondaryColor}
)

Like SourceSpan.highlight, but also highlights secondarySpans to provide the user with additional context.

Each span takes a label (label for this span, and the values of the secondarySpans map for the secondary spans) that's used to indicate to the user what that particular span represents.

If color is true, ANSI terminal color escapes are used to color the resulting string. By default this span is colored red and the secondary spans are colored blue, but that can be customized by passing ANSI escape strings to primaryColor or secondaryColor.

Each span in secondarySpans must refer to the same document as this span. Throws an ArgumentError if any secondary span has a different source URL than this span.

Note that while this will work with plain SourceSpans, it will produce much more useful output with SourceSpanWithContexts (including FileSpans).

Implementation

String highlightMultiple(String label, Map<SourceSpan, String> secondarySpans,
        {bool color = false, String? primaryColor, String? secondaryColor}) =>
    Highlighter.multiple(this, label, secondarySpans,
            color: color,
            primaryColor: primaryColor,
            secondaryColor: secondaryColor)
        .highlight();