buildUrl static method Null safety

String buildUrl(
  1. {required double size,
  2. int? imageId,
  3. String? uniqueId}
)

Implementation

static String buildUrl({
  required double size,
  int? imageId,
  String? uniqueId,
}) {
  size = size.clamp(0, 1000);
  var result = 'https://i.pravatar.cc/${size.toInt()}';

  if (imageId != null) {
    result += '?img=$imageId';
  } else if (uniqueId != null) {
    result += '?u=${Uri.encodeQueryComponent(uniqueId)}';
  }

  return result;
}