call method

  1. @override
String call(
  1. String text
)
override

The text under this style, opened before it and closed after it.

print(red.bold('Careful'));

Each line is opened and closed on its own, so the style survives being cut, and a style already in the text is unwound back to this one rather than left as it was. A hyperlink survives it too: a line closes the one it opened, the way a printed line does, and the line after opens it again, so a link a line break falls inside of stays one link.

Escape codes in text keep their terminal meaning. A selective reset returns that property to the terminal's default, which this style replaces; it does not reveal an earlier value set inside text. Use StackedPrinter when resets are meant to close nested style operations one level at a time.

Implementation

@override
String call(String text) => text;