parseDeepLink static method

DeepLinkData? parseDeepLink(
  1. Uri url
)

Parses a URL into DeepLinkData

  • url: The URL to parse
  • Returns: DeepLinkData with extracted information, null if no short code found

Implementation

static DeepLinkData? parseDeepLink(Uri url) {
  final shortCode = extractShortCode(url);
  if (shortCode == null) {
    return null;
  }

  final utmParameters = extractUTMParameters(url);
  final customParameters = extractCustomParameters(url);

  // Determine platform-specific URL field
  // In Flutter, we set both iosURL and androidURL to the same value
  // or you can use Platform.isIOS/Platform.isAndroid to set conditionally
  return DeepLinkData(
    shortCode: shortCode,
    iosURL: url.toString(),
    androidURL: url.toString(),
    utmParameters: utmParameters,
    customParameters: customParameters.isNotEmpty ? customParameters : null,
  );
}