resolveProfile static method

Future<SlugMatch?> resolveProfile(
  1. String slug
)

Resolve a profile by slug — used for /p/{slug} short URLs.

Implementation

static Future<SlugMatch?> resolveProfile(String slug) async {
  if (slug.isEmpty) return null;

  AppConfig.logger.d('SlugRouter: resolving profile "$slug"');
  final profile = await ProfileFirestore().getBySlug(slug);
  if (profile != null && profile.id.isNotEmpty) {
    return SlugMatch(type: 'profile', id: profile.id, slug: slug, entity: profile);
  }
  return null;
}