IndiStreamDecoder constructor
IndiStreamDecoder({
- required void onCommand(
- IndiCommand command
- required void onError(
- IndiProtocolException error
- int maxTextLength = 4 * 1024 * 1024,
Creates a decoder that reports commands to onCommand and problems to
onError.
Implementation
IndiStreamDecoder({
required void Function(IndiCommand command) onCommand,
required void Function(IndiProtocolException error) onError,
int maxTextLength = 4 * 1024 * 1024,
}) {
_parser = IndiXmlParser(
maxTextLength: maxTextLength,
onError: onError,
onElement: (element) {
final IndiCommand command;
try {
command = commandFromXml(element);
} on IndiProtocolException catch (e) {
onError(e);
return;
}
onCommand(command);
},
);
}