GgPrompts class abstract
Asks the user a question on the terminal.
Every interactive prompt in the gg suite goes through GgPrompts.current. Two reasons:
package:interact, which draws the prompts, reachesdart:ffithroughpackage:dart_console— a librarydart compile wasmdoes not have. The conditional import above keeps it out of a Wasm build entirely.- 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
optionsand 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