canEncode method
Implementation
bool canEncode(String contents, Charset charset, int position) {
final c = contents.codeUnitAt(position);
switch (charset) {
case Charset.A:
return c == Code128Writer._escapeFnc1 ||
c == Code128Writer._escapeFnc2 ||
c == Code128Writer._escapeFnc3 ||
c == Code128Writer._escapeFnc4 ||
A.contains(c);
case Charset.B:
return c == Code128Writer._escapeFnc1 ||
c == Code128Writer._escapeFnc2 ||
c == Code128Writer._escapeFnc3 ||
c == Code128Writer._escapeFnc4 ||
B.contains(c);
case Charset.C:
return c == Code128Writer._escapeFnc1 ||
(position + 1 < contents.length &&
isDigit(c) &&
isDigit(contents.codeUnitAt(position + 1)));
default:
return false;
}
}