ConsoleHelper class

Constructors

ConsoleHelper()

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

chooseOption(String prompt, List<String> options, {bool isMultiSelect = false, String selectedIndicator = "[x]", String unselectedIndicator = "[ ]", String selectionIndicator = "->"}) List<int>
clear() → void
Clear the console's window and reset the cursor to the top left.
confirm({String? prompt, List<String>? acceptedAffirmatives}) Future<bool>
Confirm the user's choice with an affirmative keywork or a negative keyword, mostly (yes/no).
executeCommand(String command) Future
Execute a terminal command (Return the output if exists).
exit(int code, {bool withNewLine = true, bool withClearing = false}) → void
Exit the console session.
getUserInput({required String promptBuilder(String?, int?), String? defaultValue, Duration? timeOut}) Future<String>
Ask for user input asynchronously, You can add a timeout period and a default value (When the timeout runs or when he enters an empty value).
justifyMap(Map<String, String> map, {String preKey = '', int gapSeparatorSize = 8, String postValue = ''}) List<String>
Write a map of keys and values with justification of the values.
loadWithTask({required String task, required Future process(), ConsoleLoader? loader, ConsoleColor? loaderColor, Duration? loaderSpeed, LoaderPosition? loaderPosition, String? loaderSuccessReplacement, ConsoleLoaderBase? customLoader}) Future<void>
Supply a task and a process future for that task, and show a beautiful loader till the task is finished. You can also customize a replacement output when it's done.
write(String text, {bool newLine = false, bool overwrite = false}) → void
Write text to the console, You can use styling extension like .withColor() and .withAlignment()
writeSpace() → void
Write a new empty line to the console