image function

String image({
  1. String? size,
  2. String? background,
  3. String? foreground,
  4. ImageFormat? format,
  5. String? text,
})

return a random image url.

size is the size of the image, (width)x(height), example: 320x240. background is the background color of the image, example: ffffff, 09f, ef, c. foreground is the foreground color of the image, example: ffffff, 09f, ef, c. format is the format of the image. text is the text you want paint on the image.

Implementation

String image(
    {String? size,
    String? background,
    String? foreground,
    ImageFormat? format,
    String? text}) {
  size ??= pick(sizes);
  return 'http://dummyimage.com/$size${background != null ? '/$background' : ''}${foreground != null ? '/$foreground' : ''}${format != null ? '.${format.toString().split('.')[1]}' : ''}${text != null ? '&text=$text' : ''}';
}