I am storing Firestore image url in my db and fetch directly form flutter app. It is very slow even compare with image hosting on DO's 6$ per month server. It took me nearly one minute to show the images. Is there anyway to improve the speed?
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(album.albumCover),
fit: BoxFit.cover,
),
),
child: Align(
alignment: Alignment.bottomRight,
child: Container(
margin: const EdgeInsets.all(5),
//padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(100)),
child: const Icon(
Icons.play_arrow,
color: Colors.white,
),
),
),
)
CodePudding user response:
Hello you need can use CachedNetworkImage instead of NetworkImage refer below
CachedNetworkImage(
imageUrl: "your_image_url",
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => Icon(Icons.error),
),
let me know if you have any query