randomImage static method

String randomImage({
  1. String slug = 'my',
  2. Size size = const Size(300, 300),
  3. ImageSet set = ImageSet.any,
  4. ImageBg bg = ImageBg.any,
  5. ImageType imageType = ImageType.png,
  6. String category = 'photo',
  7. ImageColor? color,
})

Generates a random image URL from robohash with the specified dimensions and category filter.

The width and height parameters specify the dimensions of the image. The category parameter specifies the category of the image.

Returns a string representing the URL of the random image.

Implementation

static String randomImage({
  String slug = 'my',
  Size size = const Size(300, 300),
  ImageSet set = ImageSet.any,
  ImageBg bg = ImageBg.any,
  ImageType imageType = ImageType.png,
  String category = 'photo',
  ImageColor? color,
}) {
  final imageColor =
      color != null ? '&color=${color.name.toLowerCase()}' : '';
  final data =
      'https://robohash.org/$slug.${imageType.name}?size=${size.width.toInt()}x${size.height.toInt()}&set=${set.name}&bgset=${bg.name}$imageColor';
  return data;
}