MeshagentTerminalController constructor

MeshagentTerminalController({
  1. void onOutput(
    1. String data
    )?,
  2. void onResize(
    1. int width,
    2. int height,
    3. int pixelWidth,
    4. int pixelHeight,
    )?,
  3. int cols = 120,
  4. int rows = 32,
})

Implementation

MeshagentTerminalController({
  void Function(String data)? onOutput,
  void Function(int width, int height, int pixelWidth, int pixelHeight)?
  onResize,
  int cols = 120,
  int rows = 32,
}) : _onOutput = onOutput,
     _onResize = onResize {
  _cols = cols;
  _rows = rows;
  _terminal = flterm.TerminalController(
    config: flterm.TerminalConfig(cols: cols, rows: rows),
  );
  _terminal.onOutput = (data) {
    _onOutput?.call(utf8.decode(data, allowMalformed: true));
  };
  _terminal.onResize = (cols, rows) {
    _cols = cols;
    _rows = rows;
    _onResize?.call(cols, rows, 0, 0);
  };
  _terminal.addListener(notifyListeners);
}