parseBody method

void parseBody(
  1. String fileContent
)

Parses the body of the FB2 file from the given fileContent. Throws an exception if the file does not contain a body.

Implementation

void parseBody(String fileContent) {
  final RegExpMatch? bodyRegExp =
      RegExp(r'<body>([\s\S]+?)<\/body>').firstMatch(fileContent);
  if (bodyRegExp == null) {
    throw Exception('The file does not contain body');
  }
  body = FB2Body(bodyRegExp.group(1)!);
}