未处理的异常:类型'String'不是类型'List< String>'的子类型 [英] Unhandled Exception: type 'String' is not a subtype of type 'List<String>'

查看:42
本文介绍了未处理的异常:类型'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),
                                        ),

这篇关于未处理的异常:类型'String'不是类型'List&lt; String&gt;'的子类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆