generatePages method

  1. @override
Future<List<List<Widget>>> 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<List<pw.Widget>>> generatePages({
  required List<Delta> documents,
}) async {
  LinkedHashSet<List<pw.Widget>> docMap = LinkedHashSet<List<pw.Widget>>();
  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(List<pw.Widget>.from(await blockGenerators(document!)));
    }
    i++;
  }
  return List<List<pw.Widget>>.from(docMap);
}