heloo,我想创建一个带有列表图像的 pdf 文件。当我运行我的按钮代码时,我收到错误消息异常发生。_TypeError(类型“Future”不是“Uint8List”类型的子类型)。
我的按钮:
ButtonWidget(
text: 'Export PDF',
onClicked: () async {
final pdfFile = await ExportPdfApi.generateMyPDF();
ExportPdfApi.openFile(pdfFile);
},
),
函数获取图像:
static viewImage(image) async {
print("print $image");
final imageJpg1 = (await NetworkAssetBundle(Uri.parse(image)).load(image))
.buffer
.asUint8List();
print("print $imageJpg1");
return imageJpg1;
}
我的pdf中的列表视图:
ListView.builder(
itemCount: _listAnggotaController.dataList.length,
itemBuilder: (context, index) {
return ClipRRect(
horizontalRadius: 32,
verticalRadius: 32,
child: Image(
MemoryImage(viewImage(
_listAnggotaController.dataList[index].idGambar)),
height: 100,
),
);
}),
请帮助我的问题。谢谢你。