out function

void Function(String, String) out(
  1. String prefix,
  2. Stdout out,
  3. Styles style
)

Implementation

void Function(String, String) out(String prefix, Stdout out, Styles style) {
  late final String Function(String) color;
  if (stdout.supportsAnsiEscapes) {
    color = (text) => buildEscSeq(style) + text + buildEscSeq(Styles.RESET);
  } else {
    color = (text) => text;
  }
  return (stack, msg) {
    late final String tip;
    if (stack == _pre) {
      tip = ' ';
    } else {
      _pre = stack;
      tip = color(stack + prefix);
    }
    out.write(tip + msg + '\n');
  };
}