Anil NS
Anil NS

Reputation: 74

How to cache image from was s3 url in flutter

I had a AWS S3 image url.I want to cache the image once its downloaded in my flutter app,How can I achieve that

Upvotes: 0

Views: 596

Answers (2)

Abo
Abo

Reputation: 1

CachedNetworkImageProvider(
  pictureUrl,
  cacheKey: pictureUrl.split("?")[0]
)

Upvotes: 0

Dowlpack
Dowlpack

Reputation: 318

You can use CachedNetworkImage

CachedNetworkImage(
  imageUrl: 'https://your.url',
  progressIndicatorBuilder: (context, url, progress) => Center(child: CircularProgressIndicator()),
  height: MediaQuery.of(context).size.height * 0.1,
  placeholder: (context, url) => Image.asset('images/NoImage.png'),
),

Or if you want to store image on your device than you can use sqflite and store image to database as Uint8List or String bytes. Image widget has method Image.memory for get image from Uint8List which stored on your database

Upvotes: 0

Related Questions