String extractService(Uri uri) { final parts = uri.host.split('.'); if (parts.length == 4) return parts.first; throw Exception('Unable to detect service in ${uri.host}.'); }