๐ ๏ธ promptr
A simple and extensible Dart package for building interactive command-line interfaces.
promptr
makes it easy to gather input from users with clean prompts and multiple input typesโtext, numbers, confirmations, and even menu-style options. Perfect for robust CLI tools and scripts.
โจ Features
- Prompt for single-line or multi-line text input
- Default value support
- Yes/no confirmations
- Integer input with validation
- Single or multiple choice menus
- ANSI color support
๐ Getting Started
๐ฆ Installation
Add promptr
to your pubspec.yaml
:
dependencies:
promptr: ^1.0.0
Then run:
dart pub get
๐งช Example
import 'package:io/ansi.dart';
import 'package:promptr/promptr.dart' as promptr;
/// Example: Developer Profile Setup CLI using `promptr`.
void main() {
print('๐จโ๐ป Welcome to Developer Profile Setup!\n');
// Prompt for the developer's username
final username = promptr.get('Choose a username');
print('Nice to meet you, @$username!');
// Ask for a short bio with multiline support
final bio = promptr.get(
'Write a short bio (use \\ to escape line breaks):',
allowMultiline: true,
inputColor: cyan,
);
print('\nBio saved!');
// Ask for primary programming language
final languages = ['Dart', 'Python', 'JavaScript', 'C++', 'Go'];
final primaryLang = promptr.choose(
'Pick your primary programming language:',
languages,
defaultsTo: 'Dart',
);
print('Primary language set to: $primaryLang');
// Ask for years of experience with integer validation
final experience = promptr.getInt(
'How many years of coding experience do you have?',
defaultsTo: 2,
);
print('Great! $experience years of experience logged.');
// Ask for technologies familiar with (multi-select)
final techStack = ['Flutter', 'Node.js', 'Firebase', 'Docker', 'Kubernetes'];
final knownTech = promptr.multiChoose(
'Select all technologies youโve worked with:',
techStack,
);
print('Your tech stack: ${knownTech.join(', ')}');
// Confirm if they want to save this profile
final shouldSave = promptr.getBool('Do you want to save your profile?');
if (shouldSave) {
print(green.wrap('\nโ
Profile saved successfully!'));
} else {
print(red.wrap('\nโ Profile not saved.'));
}
}
๐ API Overview
Method | Description |
---|---|
promptr.get(...) |
Prompt for user input (supports multiline) |
promptr.getBool(...) |
Yes/No confirmation |
promptr.getInt(...) |
Prompt for an integer with optional default |
promptr.choose(...) |
Multi-line, user-friendly choice menu |
promptr.chooseShorthand(...) |
Quick one-liner style menu |
promptr.multiChoose(...) |
Select multiple options from a list |
๐ธ Demo Project

Check out this dart package built using promptr:
๐ flutter_starter_x on pub.dev
๐งฉ Contributions
Got a new prompt idea? Open a PR or issue!
๐ License
MIT ยฉ 2025 \Mohammed Shibil M