startTracking method

  1. @override
void startTracking()
override

Begins monitoring terminal size changes

Implementation

@override
void startTracking() {
  // Initialize with current terminal size
  _currentSize = Size(stdout.terminalColumns, stdout.terminalLines);

  // Ensure we're on a supported platform
  if (!Platform.isLinux &&
      !Platform.isMacOS &&
      Platform.operatingSystem.toLowerCase() != 'solaris') {
    throw UnsupportedError('POSIX tracking only supported on Unix-like OS');
  }

  // Set up SIGWINCH handler for terminal resize events
  _sigwinchSub = ProcessSignal.sigwinch.watch().listen((_) {
    _currentSize = Size(stdout.terminalColumns, stdout.terminalLines);
    listener?.call();
  });
}