parseDescription method
Parses the description from the given fileContent.
The fileContent should be a string containing the content of a file.
This method uses a regular expression to extract the description from the file content.
If the description is not found, an exception is thrown.
The extracted description is then assigned to the description property.
Additionally, it retrieves the image with the ID 'cover.jpg' from the images list
and assigns it to the description object.
Implementation
void parseDescription(String fileContent) {
final RegExpMatch? descriptionRegExp =
RegExp(r'<description>([\s\S]+?)<\/description>')
.firstMatch(fileContent);
if (descriptionRegExp == null) {
throw Exception('The file does not contain description');
}
description = FB2Description(descriptionRegExp.group(1)!,
images.firstWhere((element) => element.id == 'cover.jpg'));
}