testing library
High-level testing utilities for Terminice CLIs.
Import this sidecar library from tests to get the public Terminice API, core terminal testing primitives, and the high-level TerminiceTester.
Classes
- BoolConfigurable
- A configurable boolean field rendered as a confirm prompt.
- CardRender
- ChoiceItem
-
Defines the content for a
choiceSelectorcard. - ColumnConfig
- Configuration for a table column.
- CommandEntry
- Represents a command exposed through the palette.
- ConfigFactory
- Shorthand factory for creating Configurable fields.
- ConfigResult
- Result returned by the config editor after the user confirms.
-
Configurable<
T> - Base class for all configurable fields in a config editor.
- CursorState
- Cursor state for text input prompts.
- DartTerminal
- Default Terminal implementation using dart:io stdin/stdout.
- DartTerminalInput
- Default TerminalInput implementation using dart:io stdin.
- DartTerminalOutput
- Default TerminalOutput implementation using dart:io stdout.
- DiscreteValuePrompt
- DiscreteValuePrompt – for discrete value selection (ratings, stars).
- DisplayFeatures
- Display feature flags controlling presentation behavior.
-
DynamicListPrompt<
T> - DynamicListPrompt – composable system for lists with dynamic items.
- EndBehavior
- Configuration for end-of-prompt behavior.
- EnumConfigurable
- A configurable field that selects from a fixed set of string options.
- ErrorTerminal
- A terminal that always throws to test error handling.
- ErrorTerminalInput
- ErrorTerminalOutput
- FallbackFormField
- Field configuration used by FallbackPrompt.form.
- FallbackFormResult
- Result returned by FallbackPrompt.form.
- FallbackPrompt
- Line-mode prompt primitives for limited terminal environments.
- FallbackRangeResult
- Result returned by FallbackPrompt.range.
- FlowBuilder
- Builds and runs a synchronous Terminice flow.
- FlowContext
- Read-only view of values collected by earlier flow steps.
- FlowProgressOptions
- Progress display options used by FlowBuilder.progress.
- FlowResult
- Result returned after a flow confirms or cancels.
- FlowReviewOptions
- Review screen options used by FlowBuilder.review.
- FlowSummaryItem
- Summary metadata for a collected flow value.
- Manages focus navigation (with optional per-item error tracking) for views where every item is already visible.
- FormFieldConfig
- Configuration for a single text field inside a FormPrompt.
- FormPrompt
- A multi-field text input prompt rendered inside a single FrameView.
- FormResult
- The confirmed result of a FormPrompt, containing all field values.
- FrameContext
- Context passed to the content callback during frame rendering.
- FramedLayout
- FramedLayout – pure string generator for framed terminal output.
- FrameRenderer
- Helpers to render titles and horizontal border lines consistently.
- FrameView
- FrameView – Composable frame rendering for terminal views.
- GridLayout
- Layout information for a grid.
- Manages 2D grid navigation with predictable wrapping semantics.
-
GridRow<
T> - A row of items in a grid.
- GroupConfigurable
- A configurable that groups child fields into a nested editor.
- HelpDoc
- Represents a single searchable help document.
- HintFormat
- Centralized formatting helpers for keyboard hint blocks.
- InlineProgressBar
- Theme-aware inline progress indicator meant for log-style updates.
- InlineSpinner
- Minimal spinner intended for inline log output.
- InlineStyle
- InlineStyle – theme-aware inline text styling utilities.
- KeyBinding
- A single key binding that maps key events to actions.
- KeyBindings
- A composable collection of key bindings.
- KeyEvent
- Normalized key event captured from terminal input.
- KeyEventReader
- Synchronous key event reader for raw terminal input.
- LineBuilder
- LineBuilder – Centralized line-level styling utilities for terminal views.
- Manages list navigation state (selection + viewport scrolling) for terminal and TUI experiences.
- ListViewport
- Viewport information for list rendering.
-
ListWindow<
T> - A window of visible items from a list.
- LoadingSpinner
- Theme-aware loading spinner with multiple visual styles.
- MockTerminal
- A mock terminal implementation for testing.
- MockTerminalInput
- Mock input that allows queuing bytes and lines for testing.
- MockTerminalOutput
- Mock output that captures all written content for assertions.
- NumberConfigurable
- A configurable numeric field with optional slider mode.
- PasswordConfigurable
- A configurable password/secret field with masked display.
- ProgressBar
- Themed progress bar for displaying determinate progress.
- ProgressDots
- Frame-based dots indicator for ambient progress feedback.
- PromptRunner
- A centralized runner for interactive terminal prompts.
-
PromptState<
T> - Mutable state container for prompt values.
- PromptTheme
- Rich styling bundle composing colors, glyphs, and display features.
- RangeConfigurable
- A configurable dual-handle range field.
- RangeResult
- RangeValue
- Internal pair to hold the two endpoints of a range.
- RangeValuePrompt
- RangeValuePrompt – for selecting a range with two handles.
-
RankedItem<
T> - A ranked item with score and highlight spans.
-
RankedListPrompt<
T> - RankedListPrompt – composable system for searchable lists with custom ranking.
- RankResult
- Result of ranking an item.
- RatingConfigurable
- A configurable star-rating field.
- RenderOutput
- A line-tracking output buffer that only clears what it wrote.
-
SearchableListPrompt<
T> - SearchableListPrompt – composable system for searchable/filterable list prompts.
-
SelectableGridPrompt<
T> - SelectableGridPrompt – composable system for grid-based selection prompts.
-
SelectableListPrompt<
T> - SelectableListPrompt – composable system for list-based selection prompts.
-
SelectableListPromptBuilder<
T> - Builder for creating customized SelectableListPrompt instances.
- SelectionController
- Manages selection state for list and grid based views.
-
SimplePrompt<
T> -
SimplePrompt<T>– A lightweight, composable prompt wrapper. - SimplePrompts
- Factory methods for common SimplePrompt patterns.
- SpyTerminal
- A terminal that tracks method calls for verification.
- SpyTerminalInput
- SpyTerminalOutput
- StringConfigurable
- A configurable string field using a text or multiline prompt.
- SyncPrompts
- Factory methods for common sync prompt patterns.
- SyntaxHighlighter
- SyntaxHighlighter – theme-aware syntax highlighting utilities.
- TableRenderer
- Centralized table rendering utility.
- TaskProgress
- Mutable progress state passed to AsyncTaskExtensions.progressTask.
- Terminal
- Abstract terminal interface for I/O operations.
- TerminalColors
- Color palette for terminal output using ANSI escape sequences.
- TerminalContext
- Global context for accessing the current Terminal instance.
- TerminalContextSnapshot
- A restorable snapshot of TerminalContext's terminal slot.
- TerminalControl
- Terminal utilities used across components and prompts to manage raw mode and input.
- TerminalGlyphs
- Glyph set for structural terminal elements.
- TerminalInfo
- Provides safe, cached access to terminal dimensions with sensible defaults.
- TerminalInput
- Abstract input interface for terminal operations.
- TerminalModeState
- Captures original terminal state and restores it on restore.
- TerminalOutput
- Abstract output interface for terminal operations.
- TerminalOutputSnapshot
- Captured terminal output with assertion-friendly derived text.
- TerminalScript
- Immutable, reusable terminal input queued for a MockTerminal.
- TerminalScriptBuilder
- Fluent builder for TerminalScript.
- TerminalScriptStep
- One reusable queued-input operation in a TerminalScript.
- TerminalSession
- Manages terminal session state (cursor visibility, raw mode).
- TerminalSize
- Terminice
- Fluent theme-aware builder that exposes every prompt as an extension method.
-
TerminiceComponent<
T> - A reusable custom component that runs against a configured Terminice.
- TerminiceComponentContext
- Execution context for a custom TerminiceComponent.
- TerminiceConfig
- Immutable configuration shared by a Terminice instance.
- TerminiceTester
- Opt-in harness for testing high-level Terminice CLIs.
- TextInputBuffer
- Manages text input state with cursor positioning.
- TextInputState
- Extended state for text input prompts.
- TextPromptSync
-
TextPromptSync– Sync text input prompt with validation. - TextWithBlockCursor
- ThemeConfigurable
- A configurable that lets the user pick a PromptTheme from a list.
- ToggleItem
- Represents a single row in a toggle group.
- ValuePrompt
- ValuePrompt – composable system for continuous value selection.
Enums
- BadgeTone
- Semantic badge tones shared by style-aware components.
- ColumnAlign
- Alignment options for table columns.
- DynamicAction
- Actions that can be returned from dynamic list handlers.
- FlowProgressStyle
- Progress display styles supported by flow metadata.
- HintStyle
- Hint display style options for keyboard bindings.
- KeyActionResult
- Result of a key action handler.
- KeyEventType
- Normalized terminal key event types.
- PromptResult
- Result from a prompt indicating whether it was confirmed or cancelled.
- SpinnerFrames
- Spinner frame styles.
- SpinnerStyle
- Available visual styles for spinners and shimmer effects.
- StatTone
- Tone for stat/styled items.
- TaskDisplay
- Rendering mode used by AsyncTaskExtensions.task and progress helpers.
- TaskFinalBehavior
- Controls what remains on screen when a task finishes.
- TaskRunningIndicator
- Running indicator used by inline task renderers.
- TerminalCompatibility
- Broad terminal capability levels for adapting prompt themes.
- TerminalScriptStepKind
- The kind of input operation represented by a TerminalScriptStep.
- TerminiceFallbackMode
- Policy for choosing high-level line-mode fallbacks.
Mixins
- Helper for path-like navigation.
- Helper for tree-like hierarchical navigation.
Extensions
- AsyncTaskExtensions on Terminice
- Adds high-level async task rendering to Terminice.
- CheatSheetExtensions on Terminice
- Provides the cheatSheet method for rendering reference tables.
- CheckboxSelectorExtensions on Terminice
-
Extension providing the checkboxSelector prompt for
Terminice. - ChoiceSelectorExtensions on Terminice
-
Extension providing the choiceSelector prompt for
Terminice. - ColorPickerPromptExtensions on Terminice
-
Keyboard-first
colorPickerprompt for Terminice. - CommandPaletteExtensions on Terminice
-
Extension providing the commandPalette prompt for
Terminice. - ConfigEditorExtensions on Terminice
- Config editor that presents a themed, searchable list of configurable fields and lets the user edit each one using the appropriate prompt.
- ConfigFactoryExtension on Terminice
- Provides config as a shorthand factory for creating configurables.
- ConfirmPromptExtensions on Terminice
- Accessible confirm prompt with themed buttons and sensible default focus.
- DatePickerExtensions on Terminice
- Adds the datePicker method to Terminice for interactive calendar-based date selection.
- DatePromptExtensions on Terminice
-
Adds the production-grade, keyboard-first
dateprompt toTerminice. - FilePickerExtensions on Terminice
- Adds the filePicker method to Terminice for interactive file browsing.
- FormPromptExtensions on Terminice
- Multi-field text input form rendered inside a single themed frame.
- FrameViewDisplayExtensions on FrameView
- Extension methods for display-only (non-interactive) frame rendering.
- GridSelectorExtensions on Terminice
- Generic 2D grid selector with arrow-key navigation.
- HelpCenterExtensions on Terminice
- Provides the helpCenter method for interactive documentation.
- HintKeybindingsExtensions on KeyBindings
-
Convenience extensions so
KeyBindingscan emit polished hint strings. - HotkeyGuideExtensions on Terminice
- Provides the hotkeyGuide method for documenting keyboard shortcuts.
- InlineProgressBarExtensions on Terminice
- Adds the inlineProgressBar method to the Terminice instance.
- InlineSpinnerExtensions on Terminice
- Adds the inlineSpinner method to the Terminice instance.
- LoadingSpinnerExtensions on Terminice
- Adds the loadingSpinner method to the Terminice instance.
- MockTerminalInputScriptExtension on MockTerminalInput
- Scripting conveniences for MockTerminalInput.
- MockTerminalOutputSnapshotExtension on MockTerminalOutput
- Snapshot conveniences for MockTerminalOutput.
- MockTerminalScriptExtension on MockTerminal
- Scripting conveniences for MockTerminal.
- MockTerminalSnapshotExtension on MockTerminal
- Snapshot conveniences for MockTerminal.
- MultiLineInputPromptExtensions on Terminice
- Multi-line editor prompt that emulates a lightweight terminal text area with scrolling, cursor management, and full keyboard bindings.
- PasswordPromptExtensions on Terminice
- Password prompt with masking, optional reveal toggle, and theme-aware status hints.
- PathPickerExtensions on Terminice
- Adds the pathPicker method to Terminice for interactive directory and file selection.
- ProgressBarExtensions on Terminice
- Adds the progressBar method to the Terminice instance.
- ProgressDotsExtensions on Terminice
- Adds the progressDots method to the Terminice instance.
- PromptRunnerFrameExtension on PromptRunner
- Extension to simplify FrameView usage with PromptRunner.
- PromptThemeCompatibility on PromptTheme
- Applies TerminalCompatibility to a PromptTheme.
- RangePromptExtensions on Terminice
- Dual-handle range prompt for selecting a numeric or percentage span.
- RatingPromptExtensions on Terminice
- Star rating prompt with gradient stars, optional labels, and numeric shortcuts.
- SearchSelectorExtensions on Terminice
- Presents a filterable list with optional multi-select controls.
-
SelectableGridPromptCards
on SelectableGridPrompt<
T> - Extension for card-style grid rendering (ChoiceMap pattern).
-
SelectableGridPromptTags
on SelectableGridPrompt<
T> - Extension for tag-style grid rendering.
-
SelectableListPromptExt
on SelectableListPrompt<
T> - Extension for adding select-all functionality.
- SelectionControllerExt on SelectionController
- Extension to integrate SelectionController with ListNavigator.
-
SimplePromptBuilder
on SimplePrompt<
T> - Extension for creating SimplePrompt with builder pattern.
- SimpleTextInput on TextInputBuffer
- Extension for simpler text-only usage (no cursor tracking).
- SliderPromptExtensions on Terminice
- Interactive slider prompt for continuous value selection with a theme-aware bar renderer.
- SpinnerStyleExtensions on SpinnerStyle
- Extension methods for SpinnerStyle to provide string representations.
- TagSelectorExtensions on Terminice
-
Extension providing the tagSelector prompt for
Terminice. - TerminiceComponentRunner on Terminice
- Shared execution helper for high-level Terminice components.
- TerminiceFlowExtensions on Terminice
- Flow helpers for running a sequence of synchronous Terminice steps.
- TerminiceMessageExtensions on Terminice
- Adds small synchronous message primitives to Terminice.
- TextInputBindingsExtensions on TextInputBuffer
- TextPromptExtensions on Terminice
- Text input prompt with placeholder support, inline validation, and clear control hints that render cleanly on pub.dev.
- ThemeDemoExtensions on Terminice
- Provides the themeDemo method for previewing bundled themes.
- ThemeExtensions on Terminice
- Fluent theme-aware builder that exposes every prompt as an extension method.
- ToggleGroupExtensions on Terminice
-
Extension providing the toggleGroup prompt for
Terminice. - ValuePromptRendering on FrameContext
- Helper extension for rendering value prompts.
Constants
-
arcsFrames
→ const List<
String> - Unicode arc-style spinner frames (quarter-circle characters).
-
barsFrames
→ const List<
String> - Unicode bar-style spinner frames (block elements).
-
builtInThemes
→ const Map<
String, PromptTheme> - Built-in theme presets mapped by name.
-
dotsFrames
→ const List<
String> - Unicode dot-style spinner frames (braille characters).
Properties
- terminice → Terminice
-
Global entry point for the default Terminice client using
PromptTheme.dark and the default DartTerminal.
final
Functions
-
clampInt(
int value, int min, int max) → int -
Clamps
valuebetweenminandmax(inclusive). -
columnWidth(
Iterable< String> values, {int min = 0, int max = 999}) → int - Computes optimal column width from content lengths, clamped to bounds.
-
columnWidthVisible(
Iterable< String> values, {int min = 0, int max = 999}) → int - Computes optimal column width from styled content (ANSI-aware).
-
fuzzyMatch(
String text, String pattern) → RankResult? - Standard fuzzy matcher with scoring.
-
highlightSpans(
String text, List< int> indices, PromptTheme theme) → String - Highlights matched spans in text using theme colors.
-
highlightSubstring(
String text, String query, PromptTheme theme, {bool enabled = true}) → String -
Highlights the first case-insensitive occurrence of
queryintextusing the theme's highlight color, preserving the rest of the string. Ifenabledis false orqueryis empty/missing, returnstextunchanged. -
maxOf(
Iterable< int> values) → int - Finds the maximum value in an iterable of integers.
-
minOf(
Iterable< int> values) → int - Finds the minimum value in an iterable of integers.
-
normalizeValidationError(
String? error) → String? - Normalizes Terminice validator results.
-
padLeft(
String text, int width) → String -
Pads
texttowidthwith leading spaces. -
padRight(
String text, int width) → String -
Pads
texttowidthwith trailing spaces. -
padVisibleCenter(
String text, int width) → String -
Centers styled
textwithinwidthbased on visible character length. -
padVisibleLeft(
String text, int width) → String -
Pads styled
texttowidthbased on visible character length, left-aligned. -
padVisibleRight(
String text, int width) → String -
Pads styled
texttowidthbased on visible character length. -
spinnerFramesList(
SpinnerFrames style) → List< String> - Returns the frame list for the given SpinnerFrames style.
-
standardMatch(
String text, String pattern, bool useFuzzy) → RankResult? - Combines fuzzy and substring matching based on mode.
-
stripAnsi(
String input) → String -
Removes ANSI escape codes from
input. -
substringMatch(
String text, String pattern) → RankResult? - Standard substring matcher with scoring.
-
toneColor(
StatTone tone, PromptTheme theme) → String - Returns the ANSI color for a StatTone.
-
truncate(
String text, int width) → String -
Truncates
texttowidthcharacters, adding an ellipsis if clipped. -
truncatePad(
String text, int width) → String -
Truncates
texttowidthand pads to fill remaining space. -
visibleLength(
String text) → int -
Returns the visible (printable) character count of
textafter stripping ANSI.
Typedefs
-
FallbackLabelBuilder<
T> = String Function(T item) - Builds a display label for a selectable fallback item.
- FallbackNumberValidator = String? Function(num value)
- Validator for fallback numeric input.
- FallbackTextValidator = String? Function(String value)
- Validator for fallback text input.
- FlowCondition = bool Function(FlowContext context)
- Decides whether a flow step should run.
-
FlowStepRunner<
T> = T? Function(FlowContext context) - Runs a custom flow step and returns its value.
-
FlowSummary<
T> = String Function(T value, FlowContext context) - Builds a review summary string for a completed flow step value.
- FlowTemplate = void Function(FlowBuilder flow)
- Adds reusable steps to a FlowBuilder.
-
FlowValidator<
T> = String? Function(T value, FlowContext context) - Validates a value returned by a flow step.
- TaskCancelPredicate = bool Function(Object error)
- Returns whether an error should be displayed as a cancellation.
- TaskErrorMessage = String Function(Object error, StackTrace stackTrace)
- Builds a failure or cancellation message from the thrown error.
-
TerminiceComponentCallback<
T> = T Function(TerminiceComponentContext context) -
Runs a custom Terminice component with a prepared component
context.
Exceptions / Errors
- FlowValidationException
- Exception thrown when a flow step returns a value that fails validation.