parseImages method

void parseImages(
  1. String fileContent
)

Parses the images from the given fileContent.

The fileContent is a string containing the content of a file. This method uses a regular expression to find and extract binary image data enclosed within <binary> and </binary> tags in the fileContent. Each extracted image is then added to the images list.

Implementation

void parseImages(String fileContent) {
  final Iterable<RegExpMatch> imagesRegExp =
      RegExp(r'<binary[\s\S]+?>([\s\S]+?)<\/binary>').allMatches(fileContent);
  for (final RegExpMatch image in imagesRegExp) {
    images.add(FB2Image(image.group(0)!));
  }
}