CappConsole class
CappConsole is a class that helps you to interact with the console. Here are some Console widgets that you can use
Constructors
- CappConsole(dynamic output, [CappColors color = CappColors.info, bool space = false])
- CappConsole is a class that helps you to interact with the console.
Properties
- color ↔ CappColors
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- output ↔ dynamic
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- space ↔ bool
-
getter/setter pair
Methods
-
log(
) → CappConsole - log method is used to print the output to the console.
-
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 Properties
- console ↔ Console
-
getter/setter pair
- empty → CappConsole
-
no setter
- isWindows → bool
-
check is windows or not
no setter
Static Methods
-
clear(
) → void - clear method is used to clear the console screen.
- Menu
-
progress<
T> (String message, Future< T> action(), {CappProgressType type = CappProgressType.bar}) → Future<T> -
progress method is used to show the progress widget of the action.
It can be a spinner, bar, or circle.
The
messageis the message that will be shown in the console. Theactionis the action that will be executed. Thetypeis the type of the progress widget. The CappProgressType is an enum that contains three types of progress widgets. -
read(
String message, {bool isRequired = false, bool isNumber = false, bool isSlug = false}) → String - read method is used to read the input from the console.
-
readMultiChoice(
String message, List< String> options, {List<String> selected = const [], CappColors color = CappColors.none, bool required = false}) → List<String> -
select(
String message, List< String> options, {bool isRequired = false}) → String -
select method is used to select an option from the list of options.
The
messageis the message that will be shown in the console. Theoptionsis the list of options. TheisRequiredis a boolean that indicates if the option is required or not. The method returns the selected option. -
write(
dynamic obj, [CappColors color = CappColors.none, dynamic space = false]) → CappConsole - write method is used to print the output to the console.
-
writeJson(
dynamic json, {bool pretty = false, CappColors color = CappColors.none, int indent = 4, String indantChar = ' '}) → CappConsole -
writeTable(
List< List< data, {bool dubleBorder = false, CappColors color = CappColors.error}) → CappConsoleString> > -
writeTable method is used to print a table in the console.
The
datais the list of lists of strings that will be shown in the table. ThedubleBorderis a boolean that indicates if the table has a double border or not. Thecoloris the color of the table. -
yesNo(
String message) → bool -
yesNo method is used to ask a question that has a yes or no answer.
The
messageis the message that will be shown in the console. The method returns a boolean value. If the answer is yes, it returns true.