terminalWidth property
int
get
terminalWidth
Get terminal width (fallback to 80 if unable to detect)
Implementation
static int get terminalWidth {
try {
// Try to get terminal width via stty
final result = Process.runSync('stty', ['size'],
runInShell: true, stderrEncoding: null, stdoutEncoding: null);
if (result.exitCode == 0 && result.stdout != null) {
final output = result.stdout as String;
final parts = output.trim().split(' ');
if (parts.length == 2) {
return int.tryParse(parts[1]) ?? 80;
}
}
} catch (_) {
// Fallback to default
}
return 80;
}