convert method
Converts input
and returns the result of the conversion.
Implementation
@override
Uint8List convert(String input, [int start = 0, int? end]) {
var runes = input.runes.toList(growable: false);
end = RangeError.checkValidRange(start, end, runes.length);
if (end - start == 0) {
return Uint8List(0);
}
var bytes = Uint8List(end - start);
for (var i = start; i < end; i++) {
if (dictionary[runes[i]] case int value?) {
bytes[i] = value;
} else {
if (allowInvalid) {
bytes[i] = 0x3F;
} else {
throw ArgumentError.value(
input, 'input', 'Contains invalid characters.');
}
}
}
return bytes;
}