flutter / dart error: The argument type 'Future' can't be assigned to the parameter type 'File'

前端 未结 4 1695
时光说笑
时光说笑 2021-02-14 06:12

I\'m trying to build my first mobile application with flutter and firebase. When I try to display and store a photo I have the following issue :

error: T

4条回答
  •  执念已碎
    2021-02-14 07:13

    From the plugin README.md

      Future getImage() async {
        var image = await ImagePicker.pickImage(source: ImageSource.camera);
    
        setState(() {
          _image = image;
        });
      }
    

    ImagePicker.pickImage() returns a Future. You can use async/await like shown in the code above the get the value from the Future.

提交回复
热议问题