isValid method

  1. @override
bool isValid(
  1. ImageInput input
)
override

Returns the input is support or not.

Implementation

@override
bool isValid(ImageInput input) {
  final length = input.length;
  final header = input.getRange(
    0,
    simpleFileHeaderAndFooter.startBytes.length,
  );
  final footer = input.getRange(
    length - simpleFileHeaderAndFooter.endBytes.length,
    length,
  );

  final headerEquals = compareTwoList(
    header,
    simpleFileHeaderAndFooter.startBytes,
  );
  final footerEquals = compareTwoList(
    footer,
    simpleFileHeaderAndFooter.endBytes,
  );
  return headerEquals && footerEquals;
}