type 'Image' is not a subtype of

2019-12-18  本文已影响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),
上一篇 下一篇

猜你喜欢

热点阅读