Unable to read Image: error: A value of type 'Future<PickedFile>' can't be assigned to a variable of type 'File'

Unable to read Image: error: A value of type 'Future<PickedFile>' can't be assigned to a variable of type 'File'

300: pickImage() async {
301:    final ImagePicker _picker = ImagePicker();
302:    final image = _picker.getImage(source: ImageSource.camera);
303:    if (image == null) return null;
304:    setState(() {
305:      _loading = true;
306:      _image = image;
307:    });
308:    classifyImage(image);
309:  }

抛出错误:

我在 main.dart 的开头添加了 // @dart=2.9

我是Flutter-Tflite的新手,有人可以指导一下吗?

出现这种情况是因为它是一个异步函数,因此您必须使用“await”。

final image = await _picker.getImage(source: ImageSource.camera);