我需要在项目中显示一个Image.memory
,但是当我将此代码放在body
的{{1}}中时,它不会显示。
Scaffold
答案 0 :(得分:0)
// Create an instance variable
Image image;
@override
void initState() {
super.initState();
// put them here
Codec<String, String> stringToBase64 = utf8.fuse(base64);
String imagenJson = "Here, I put the BASE64 string";
Uint8List _image = base64Decode(imagenJson);
image = Image.memory(_image); // assign it value here
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: image, // use it here
);
}