run method
Starts the inline prompt loop and returns a Future containing the final result.
Implementation
Future<T?> run() async {
onPromptStarted?.call(this);
if (mode == ExecutionMode.standalone) {
await _initStandaloneViewport();
} else {
_initManagedViewport();
}
StreamSubscription<Point<int>>? sizeSubscription;
StreamSubscription<term.InputEvent>? subscription;
final runScope = FocusScopeNode(id: 'prompt_runner_scope');
try {
final completer = Completer<T?>();
final rootElement = _mountRunTree(runScope, completer);
if (mode == ExecutionMode.standalone) {
(sizeSubscription, subscription) = _attachStandaloneStreams(
rootElement,
completer,
);
}
return await completer.future;
} finally {
_teardownRun(runScope, sizeSubscription, subscription);
}
}