generatePages method

  1. @override
Future<List<Map<String, dynamic>>> generatePages({
  1. required List<Delta> documents,
})
override

This function create a (valid) file transforming delta format to markdown and detecting all markdown syntax for put the attributes to the paragraph

Use the parameter for print a just one document and not all the project

Implementation

@override
Future<List<Map<String, dynamic>>> generatePages(
    {required List<Delta> documents}) async {
  LinkedHashSet<Map<String, dynamic>> docMap =
      LinkedHashSet<Map<String, dynamic>>();
  int i = 0;
  int totalDocuments = documents.length;
  while (i < totalDocuments) {
    final Delta doc = documents.elementAt(i);
    if (doc.isNotEmpty) {
      final Document? document = RichTextParser().parseDelta(doc);
      docMap.add(<String, dynamic>{
        'content': List<pw.Widget>.from(await blockGenerators(document!)),
      });
    }
    i++;
  }
  return List<Map<String, dynamic>>.from(docMap);
}