getDeepLink method

Future<String?> getDeepLink({
  1. required String url,
  2. required String idExtractionRegex,
  3. required String androidDeepLinkTemplate,
  4. required String iosDeepLinkTemplate,
})

Implementation

Future<String?> getDeepLink({
  required String url,
  required String idExtractionRegex,
  required String androidDeepLinkTemplate,
  required String iosDeepLinkTemplate,
}) async {
  String filledUrl(String id) {
    return Platform.isAndroid
        ? androidDeepLinkTemplate.replaceAll('{id}', id)
        : iosDeepLinkTemplate.replaceAll('{id}', id);
  }

  final newEntityId = await _getSocialMediaId(url, idExtractionRegex);
    logger.d('newEntityId: $newEntityId');
  if (newEntityId != null) {
    final newUrl = filledUrl(newEntityId);
    logger.d('newUrl: $newUrl');
    return newUrl;
  }
  return null;
}