// I have been trying to generate pdfs using pdf plugin and wrtie it to a pdf file
// but file.wrtieAsBytes not creating any files and its not even throwing any errors or giving any response
makePdf() async {
final pw.Document doc = pw.Document();
pw.Font font = pw.Font.ttf(await rootBundle.load('assets/Exo-Bold.ttf'));
doc.addPage(
pw.Page(
pageFormat: pdf.PdfPageFormat.a4,
build: (pw.Context context) {
return pw.Center(
child: pw.Text(
"Hello World",
style: pw.TextStyle(font: font),
),
); // Center
},
),
);
final file = File("ms.pdf");
List<int> data = doc.save();
// print(data);
file.writeAsBytes(data).then((file) {
print("done");
}).catchError((e) => print(e));
}