EmbeddedTerminalBackend constructor

EmbeddedTerminalBackend({
  1. required void output(
    1. String data
    ),
  2. Future<void> flushOutput()?,
  3. Stream<List<int>>? inputStream,
  4. Stream<TerminalDimensions>? resizeStream,
  5. Stream<void>? shutdownStream,
  6. TerminalDimensions initialSize = (width: 80, height: 24),
  7. bool supportsAnsi = true,
  8. bool isTerminal = true,
  9. ColorProfile colorProfile = ColorProfile.trueColor,
  10. ({bool useBackspace, bool useTabs}) movementCaps = (useTabs: false, useBackspace: true),
})

Creates an embedded backend.

Use addInput, notifySizeChanged, and requestShutdown to drive it from an external host, or provide external streams up front.

Implementation

EmbeddedTerminalBackend({
  required void Function(String data) output,
  Future<void> Function()? flushOutput,
  Stream<List<int>>? inputStream,
  Stream<TerminalDimensions>? resizeStream,
  Stream<void>? shutdownStream,
  TerminalDimensions initialSize = const (width: 80, height: 24),
  this.supportsAnsi = true,
  this.isTerminal = true,
  this.colorProfile = ColorProfile.trueColor,
  this.movementCaps = const (useTabs: false, useBackspace: true),
}) : _output = output,
     _flushOutput = flushOutput,
     _size = initialSize {
  _inputStreamSubscription = inputStream?.listen(_inputController.add);
  _resizeStreamSubscription = resizeStream?.listen(_resizeController.add);
  _shutdownStreamSubscription = shutdownStream?.listen(
    (_) => _shutdownController.add(null),
  );
}