【发布时间】:2026-02-07 02:20:06
【问题描述】:
我正在使用 Flute 音乐播放器插件在 Flutter 中制作音乐播放器应用程序。但我无法添加专辑封面。
我写道:
dynamic getImage(int idx) {
return _songs[idx].albumArt == null
? null
: new File.fromUri(Uri.parse(_songs[idx].albumArt));
}
我使用了 Image.file 小部件:
Container(
childe: Image.file(getImage(_index))
)
结果是:
I/flutter (15576): The following assertion was thrown building HyperMusicHome(dirty, state:
I/flutter (15576): _HyperMusicHomeState#b83f2):
I/flutter (15576): 'package:flutter/src/painting/image_provider.dart': Failed assertion: line 621 pos 14: 'file !=
I/flutter (15576): null': is not true.
I/flutter (15576):
I/flutter (15576): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (15576): more information in this error message to help you determine and fix the underlying cause.
I/flutter (15576): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (15576): https://github.com/flutter/flutter/issues/new?template=BUG.md
【问题讨论】:
-
我编辑并添加了错误信息
标签: flutter