createCommand method
Implementation
CommandDescriptor createCommand(String name, Function function, {String? i18n, String? label, IconData? icon, LockType lock = LockType.command}) {
if ( label == null) {
if (i18n != null) {
label = Translator.tr("$i18n.label");
}
else {
label = name;
}
}
var shortcut = "";
var tooltip = "";
if ( i18n != null) {
shortcut = Translator.tr("$i18n.shortcut", defaultValue: "");
tooltip = Translator.tr("$i18n.tooltip", defaultValue: "");
}
CommandDescriptor command = CommandDescriptor(name: name, function: function, i18n: i18n, shortcut: shortcut, tooltip: tooltip, label: label, icon: icon, lock: lock);
// add standard interceptors
for ( CommandInterceptor interceptor in interceptors)
command.addInterceptor(interceptor);
// the method itself
command.addInterceptor(methodInterceptor);
return command;
}