ImageUrlBuilder typedef
Function signature for generating width-specific image URLs for responsive srcset sets.
Receives the original image src and a target integer width, returning the transformed URL.
Used by buildSrcSet, bloomImage, and PictureSource to generate responsive image variants.
String cdnBuilder(String src, int width) =>
'https://images.example.com/cdn-cgi/image/width=$width,format=auto/$src';
final srcset = buildSrcSet('/hero.jpg', [400, 800, 1200], urlBuilder: cdnBuilder);
See also:
- defaultImageUrlBuilder, the standard query-parameter builder.
- buildSrcSet, which converts a list of widths into a
srcsetattribute.
Implementation
typedef ImageUrlBuilder = String Function(String src, int width);