美文网首页
type 'Image' is not a subtype of

type 'Image' is not a subtype of

作者: 失恋的寡妇 | 来源:发表于2019-12-18 15:04 被阅读0次

    type 'Image' is not a subtype of type 'ImageProvider<dynamic>'

    1、报错写法:

     decoration: BoxDecoration(
                              color: Colors.white,
                              image: DecorationImage(
                                      image: Image.file(_imagePath),
                                      fit: BoxFit.cover),
                              shape: BoxShape.circle),
    

    2、正确写法:

     decoration: BoxDecoration(
                              color: Colors.white,
                              image: DecorationImage(
                                      image: FileImage(_imagePath),
                                      fit: BoxFit.cover),
                              shape: BoxShape.circle),
    

    相关文章

      网友评论

          本文标题:type 'Image' is not a subtype of

          本文链接:https://www.haomeiwen.com/subject/irfunctx.html