Home > OS >  The argument type 'XFile?' can't be assigned to the parameter type
The argument type 'XFile?' can't be assigned to the parameter type

Time:10-20

  late XFile?  _file;
      String status = '';
      late String base64Image;
      late File tmpFile;
      String errMessage = 'Error Uploading Image';

Widget showImage() {
return FutureBuilder<File>(
future: _file,
  builder: (BuildContext context, AsyncSnapshot<File> snapshot) {

how :(?

CodePudding user response:

If you want to use FutureBuilder, you must change your _file to Future type, like this :

Future<XFile?>  _file;


_file =_picker.pickImage(source: ImageSource.gallery);  // remove await 

then you can return your FutureBuilder like you wish

  • Related