未处理的异常:类型'String'不是类型'List< String>'的子类型
问题描述:
我正在尝试共享一个包含视频的文件,但出现错误提示
Im trying to share a file which includes a video but im getting an error that says
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: type 'String' is not a subtype of type 'List<String>'
#0 _VideopageofcurrentuserState.sharevideo (package:wichtigdenyady/taking%20videos/currentuservideos.dart:90:17)
<asynchronous suspension>
这是我的代码
InkWell(
onTap: () => sharevideo(
videos.data()['videourl'],
videos.data()['id']),
child: Icon(Icons.reply,
size: 35, color: Colors.white),
),
因此,我给共享视频功能提供了视频的网址以及视频文档的ID,然后就给了我共享视频功能
So im giving the share video function the url of the video and also the id of the document of the video and then thats my share video function
sharevideo(String video, String id) async {
DocumentSnapshot doc =
await FirebaseFirestore.instance.collection('videos').doc(id).get();
var request = await HttpClient().getUrl(Uri.parse(video));
var response = await request.close();
Uint8List bytes = await consolidateHttpClientResponseBytes(response);
await Share.shareFiles(
doc.data()['videourl'],
text: 'Video.mp4',
).whenComplete(() => FirebaseFirestore.instance
.collection('videos')
.doc(id)
.update({'sharecount': doc.data()['sharecount'] + 1}));
}
我真的不知道我做错了什么,也许任何人都可以帮忙.谢谢.如果您需要更多信息,请发表评论.我正在使用此版本
I dont know really what I do wrong maybe anyone can help . Thanks. If you need more informations please leave a comment . Im using this version
share: ^2.0.1
这是我的火力发源地
[enter image description here][1]
[1]: https://i.stack.imgur.com/24yHK.png
答
我认为这可能是因为代码中的videos.data()['videourl']部分为空
I think this could be because the videos.data()['videourl'] section of your code is null
InkWell(
onTap: () => sharevideo(
videos.data()['videourl'],
videos.data()['id']),
child: Icon(Icons.reply,
size: 35, color: Colors.white),
),