Я пытаюсь показать изображение, полученное из ответа API, но ничего не отображается.
Я могу отобразить URL изображения, но не фактическое изображение.
Здесь мой код:
Вызов API:
@override
void initState() {
super.initState();
showProgressBar = true;
customFun.readToken().then((val) {
setState(() {
access_token = val;
});
(() async {
await restApis.getProfile(access_token).then((val) => setState((){
print(val);
name = val["data"]["name"];
_nameController.text = val["data"]["name"];
_emailController.text = val["data"]["email"];
_mobileController.text = (val["data"]["contact_number"]).toString();
profile_image = val["data"]["avatarUrl"];
print("-----------------------");
print(profile_image);
print("-----------------------");
showProgressBar = false;
}));
})();
});
}
Здесь отображается код изображения:
(profile_image != '') ?
Container(
width: 150.0,
height: 150.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
width: 1.0,
color: Colors.black
),
image: DecorationImage(
image: NetworkImage("$profile_image"),
fit: BoxFit.fill
),
),
): Container(),
Здесь отображается URL-адрес изображения в тексте, который работает нормально:
Container(
child: Text("$profile_image")
),