Flutter Sanity Image URL
A dart package to quickly generate sanity image urls. Ported from sanity-io/image-url.
Intented to be used together with the flutter_sanity package
Features
- Respects crops and hotspots specified in Sanity.
- Can be used to set the width and/or height of the image.
- Provides a builder to access the processing options available from Sanity.
Getting started
dart pub add flutter_sanity
dart pub add flutter_sanity_image_url
Usage
See /example
for a full example.
Creating a builder:
// sanityClient is an instance of SanityClient from flutter_sanity
final builder = ImageUrlBuilder(sanityClient);
ImageUrlBuilder urlFor(asset) {
return builder.image(asset);
}
Using the builder:
using the builder design patten the options can be added in a chain, always call url()
at the end to get the actual url of the image.
Image.network(urlFor(image).size(200, 200).url())