CappController class

CappController is a class that represents a controller in the console application. The controller is a class that contains the main logic of the application. The controller can have options that can be passed to the controller from the console.

Constructors

CappController(String name, {String description = '', required List<CappOption> options, required Future<CappConsole> run(CappController args)})
The constructor of the CappController class.

Properties

description String
The description of the controller it will be shown in the help command.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
manager CappManager
The manager of the controller it will be used to access the manager methods and properties. CappManager is mainly used to run the application.
getter/setter pair
name String
The name of the controller it will be used to call the controller from the console. For example, if the name is 'test' then the controller can be called by typing 'test' in the console. $ webapp test The name should be unique in the application.
getter/setter pair
options List<CappOption>
The options of the controller it will be used to pass the options to the controller from the console. The options can be passed to the controller by typing the option name and the value. It can be a short name or a full name. For example, if the option name is 'help' then it can be passed by typing '--help' or '-h'. The options can be required or not. The options can be have value with this format '--option value' or '-o value'.
getter/setter pair
run Future<CappConsole> Function(CappController args)
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

existsOption(String name) bool
The existsOption method is used to check if the option exists in the controller or not.
getOption(String name, {String def = ''}) String
The getOption method is used to get the value of the option by the option name.
init({required CappManager manager}) → dynamic
The init method is used to initialize the controller.
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