GgPrompts class abstract

Asks the user a question on the terminal.

Every interactive prompt in the gg suite goes through GgPrompts.current. Two reasons:

  1. package:interact, which draws the prompts, reaches dart:ffi through package:dart_console — a library dart compile wasm does not have. The conditional import above keeps it out of a Wasm build entirely.
  2. An embedder that has no terminal of its own — gg running inside a Node process, say — can answer the prompts itself by assigning GgPrompts.current.

On a native build current draws real prompts. In a Wasm build it throws GgPromptsUnsupportedError until an embedder replaces it.

Constructors

GgPrompts()
Default constructor
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

input({required String prompt, String? defaultValue, String? initialText, bool asMessageEditor = false}) Future<String>
Lets the user edit a line of text and returns what they left behind.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
select({required String prompt, required List<String> options, int initialIndex = 0}) Future<int>
Lets the user pick one of options and returns the index picked.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

current GgPrompts
The prompts the gg suite currently asks its questions with.
getter/setter pair
defaultPrompts GgPrompts
The prompts of the platform gg was compiled for.
final