Command constructor

Command(
  1. String name,
  2. Schema? schema,
  3. dynamic func
)

Creates a new command object and assigns it's parameters.

  • name the command name.
  • schema the schema to validate command arguments.
  • func the function to be executed by this command.

Implementation

/// - name      the command name.
/// - schema    the schema to validate command arguments.
/// - func      the function to be executed by this command.

Command(String name, Schema? schema, func)
    : _name = name,
      schema_ = schema,
      _function = func is IExecutable ? func.execute : func {
  if (func == null) throw Exception('Function cannot be null');

  if (!(_function is Function)) {
    throw Exception('Function doesn\'t have function type');
  }
}