prompts
2.0.0, released 5 years ago by an unverified publisher
Synchronous command-line prompt library for Dart with pretty colors.
What it does
Provides synchronous utility functions to get user input, booleans, integers, passwords, and choices from the command line. Supports default values, multiline input, and validation.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are building a command-line interface (CLI) tool in Dart
- You need synchronous user input prompts with validation and default values
Skip it when
- You are building a Flutter GUI application
- You need asynchronous event-driven streams for inputs
Strengths
- Simple and synchronous API
- Supports default values, multiline input, and ANSI colors
- Built-in methods for booleans, integers, and choice selection
Weaknesses
- Interactive selection is completely disabled on Windows
- Synchronous blocking calls are not suitable for async event loops
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
import 'package:prompts/prompts.dart' as prompts;
void main() {
var name = prompts.get('Enter your name');
print('Hello, $name!');
}Alternatives
Packages that do the same job and could replace prompts.
- cli_util
Utilities to help build Dart command-line apps, find the SDK, and display progress.
88Compare - git
Git command line wrapper for inspecting and manipulating local Git repositories.
89Compare - dart_console
A helper library for command-line applications requiring advanced control over input/output.
86Compare - cli_completion
Completion functionality for Dart Command-Line Interfaces built using CommandRunner.
85Compare
Works with
Packages commonly used together with prompts: ones it builds on, ones built on it, and its own family.
- ioprompts depends on itUtilities for the Dart VM Runtime including ANSI colors, file copying, and exit code values.
- charcodeprompts depends on itProvides named integer constants for ASCII and HTML character codes.
- melosBuilt on promptsA tool for managing Dart and Flutter monorepos with script execution, versioning, and publishing.
- rpsBuilt on promptsRun and manage scripts defined in pubspec.yaml or rps.yaml from the command line