terminal_backend.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /// interface for every Terminal backend
  2. abstract class TerminalBackend {
  3. /// initializes the backend
  4. /// This can be used to instantiate instances that are problematic when
  5. /// passed to a Isolate.
  6. /// The [TerminalIsolate] will pass the backend to the [Terminal] that then
  7. /// executes [init] from inside the Isolate.
  8. /// So when your backend needs any complex instances (most of them will)
  9. /// then strongly consider instantiating them here
  10. void init();
  11. /// Stream for data that gets read from the backend
  12. Stream<String> get out;
  13. /// Future that fires when the backend terminates
  14. Future<int> get exitCode;
  15. /// writes data to this backend
  16. void write(String input);
  17. /// notifies the backend about a view port resize that happened
  18. /// If resizeFull() is overrode, resize() will not be called, but still
  19. /// requires an empty method as a stub for API compatibility reasons.
  20. void resize(int width, int height);
  21. /// notifies the backend about a view port resize that happened, with information
  22. /// including both row/column and pixel width/height.
  23. /// Not required to be overrode if the [TerminalBackend] does not require
  24. /// pixel size information, just override resize() instead.
  25. void resizeFull(int columns, int rows, int pixelWidth, int pixelHeight) {
  26. resize(columns, rows);
  27. }
  28. /// terminates this backend
  29. void terminate();
  30. /// acknowledges processing of a data junk
  31. void ackProcessed();
  32. }