Future<void> _saveFile() async {
final data = await rootBundle.load('assets/template.docx');
final bytes = data.buffer.asUint8List();
final docx = await DocxTemplate.fromBytes(bytes);
Content c = Content();
c.add(TextContent("content", contentController.text));
final d = await docx.generate(c);
List<StorageInfo> storageInfo = await PathProviderEx2.getStorageInfo();
var root = storageInfo[0].rootDir; // root of the "external storage"
final directory = Directory("$root/Download");
final file = File('${directory.path}/${nameController.text}.docx');
if (d != null) await file.writeAsBytes(d);
}
I try using this function but it doesn't work