getProfileUrl static method

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

Creates a profile picture URL with the specified size.

Implementation

static String getProfileUrl(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/${profileSizes[size] ?? profileSizes['w185']!}$cleanPath';
}