The argument type 'Future<Widget>' can't be assigned to the parameter type 'Widget'.dart The argument type 'Future<Widget>' can't be assigned to the parameter type 'Widget'.dart dart dart

The argument type 'Future<Widget>' can't be assigned to the parameter type 'Widget'.dart


Your method must return Future<Widget>, as I'm understanding your question's title is your error, its mean that you returning a Widget not Future<Widget>. To do that, you should wrap your widget inside the Future like this:

Future<Widget> getWidgetAsync(double size) async {PdfImage val = await pdfImageFromImageProvider(  pdf: pdf.document,  image: fw.AssetImage('assets/' + iconPath),);return Future.value(Container(  width: size,  height: size,  decoration: BoxDecoration(    color: layoutbg,    shape: BoxShape.circle,  ),  child: Image(val),));

Hope this will work.