getLinkBuilder static method
Returns a link builder for the given URL.
This method first identifies the type of the app based on the URL. It then returns a link builder for the identified app type.
@param url The URL for which to create a link builder. @param logger The logger to use for logging. @param deeplinkCreator The deeplink creator to use for creating deeplinks. @return A link builder for the given URL. @throws Exception If no link builder can be found for the given URL.
Implementation
static LinkBuilder getLinkBuilder(
String url, Logger logger, DeeplinkCreator deeplinkCreator) {
final type = _identifyAppType(url);
switch (type) {
case AppType.facebook:
return FacebookLinkBuilder(deeplinkCreator);
case AppType.twitter:
return TwitterLinkBuilder(deeplinkCreator);
case AppType.instagram:
return InstagramLinkBuilder(deeplinkCreator);
case AppType.tiktok:
return TikTokLinkBuilder(deeplinkCreator);
case AppType.youtube:
return YoutubeLinkBuilder(deeplinkCreator);
case AppType.linkedin:
return LinkedInLinkBuilder(deeplinkCreator);
default:
logger.e("Unknown link type for url: $url");
}
// Conditions for other platforms
throw Exception("No link builder found for the given URL");
}