[英]Passing image from one screen to another - Flutter
我正在使用图像选择器来获取图像,一旦上传,我想传递并在不同的屏幕上显示它。 现在我收到了这个错误
“字符串”类型不是“文件”类型的子类型
第一个屏幕:
第二个屏幕:
使用
XFile?<\/code>
与
pickImage()<\/code> 。
void _openCamera(BuildContext context) async {
final XFile? pickedFile = await ImagePicker().pickImage(
source: ImageSource.camera,
);
if (pickedFile == null) return;
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => second(image: pickedFile)));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.