makeUrl method

String makeUrl({
  1. ImageExtension extension = ImageExtension.png,
  2. int? size,
})

Implementation

String makeUrl({ImageExtension extension = ImageExtension.png, int? size}) {
  if (size case int() when size < 16 || size > 4096) {
    throw ArgumentError('Size must be between 16 and 4096');
  }

  final fragments = [..._fragments, hash, extension.value];
  if (size != null) {
    fragments.add('size=$size');
  }

  return '$url/${fragments.join('/')}';
}