DefaultCommand constructor
DefaultCommand(
- List<
CommandClause> clauses, - Map<
String, Object> variable
Implementation
DefaultCommand(List<CommandClause> clauses, Map<String, Object> variable) {
FastBinary fastBinary = FastBinary.make();
for (CommandClause clause in clauses) {
switch (clause.type()) {
case ClauseType.text:
String? text = VariableKit.replace(clause.text(), variable);
if (text == null || text.isEmpty) {
continue;
}
fastBinary.appendText(text, charset: clause.charset());
break;
case ClauseType.binary:
case ClauseType.newline:
Uint8List? binary = clause.binary();
if (binary != null) {
fastBinary.appendBinary(binary);
}
break;
case ClauseType.none:
break;
}
}
bytes = fastBinary.output();
}