isSupported property
bool
get
isSupported
Returns true if stdout supports ANSI escape characters.
This detection is more reliable on non-Windows platforms.
On Windows, it relies on stdout.supportsAnsiEscapes.
On other platforms, it defaults to true unless explicitly overridden.
Implementation
static bool get isSupported {
if (_emitAnsi == null) {
// We don't trust [stdout.supportsAnsiEscapes] except on Windows.
// [stdout] relies on the TERM environment variable
// which generates false negatives.
if (!Platform.isWindows) {
_emitAnsi = true;
} else {
_emitAnsi = stdout.supportsAnsiEscapes;
}
}
return _emitAnsi!;
}
set
isSupported
(bool emit)
Override the detected ANSI settings.
Dart's ANSI detection isn't always accurate, so this provides a way to manually control ANSI output.
- If set to
true: ANSI escape characters are emitted - If set to
false: ANSI escape characters are not emitted
Use resetEmitAnsi to return to automatic detection.
Implementation
static set isSupported(bool emit) => _emitAnsi = emit;