fromCommand static method
Implementation
static DartDeclaration fromCommand(List<Command> commandList, self,
{dynamic testSubject, required String key, dynamic value}) {
var newSelf = self;
for (var command in commandList) {
if (testSubject is String) {
if ((command.prefix != null &&
testSubject.startsWith(command.prefix!))) {
if ((command.prefix != null &&
command.command != null &&
testSubject.startsWith(command.prefix! + command.command!)) ||
(command.command != null &&
testSubject.startsWith(command.command!))) {
if (command.notprefix != null &&
!testSubject.startsWith(command.notprefix!) ||
command.notprefix == null) {
newSelf =
command.callback!(self, testSubject, key: key, value: value);
break;
}
}
}
}
if (testSubject.runtimeType == command.type) {
newSelf = command.callback!(self, testSubject, key: key, value: value);
break;
}
}
return newSelf;
}