getPosterUrl static method

String getPosterUrl(
  1. String? path, {
  2. String size = 'w185',
})

Creates a poster URL with the specified size.

Implementation

static String getPosterUrl(String? path, {String size = 'w185'}) {
  if (path == null || path.isEmpty) return '';
  // Remove any existing size prefixes.

  final cleanPath = path.replaceAll(RegExp(r'/[a-z0-9]+/'), '');
  return '$_baseUrl/${posterSizes[size] ?? posterSizes['w185']!}$cleanPath';
}