handleDeepLink static method

void handleDeepLink(
  1. String link
)

Handles incoming deep links by parsing the link and performing actions based on its content @param link The deep link URL as a String @returns void

Implementation

static void handleDeepLink(String link) {
  debugPrint('Received deep link: $link');
  final uri = Uri.parse(link);

  // Handle friend request parameter from both URI schemes and HTTPS links
  final userId = uri.queryParameters['userId'];
  if (userId != null) {
    _handleFriendRequest(userId);
    return;
  }

  // Legacy path-based routing
  switch(uri.path) {
    case '/friend-request':
      final pathUserId = uri.queryParameters['userId'];
      if (pathUserId != null) {
        _handleFriendRequest(pathUserId);
      } else {
        debugPrint('Friend request missing userId parameter');
      }
      break;
    default:
      debugPrint('Unknown deep link path: ${uri.path}');
  }
}