onTapLink property

void Function(String url)? onTapLink
final

Callback function invoked when a user taps on a link.

The callback receives the URL string as a parameter. Use this to handle navigation to external URLs or internal routes.

Example:

onTapLink: (url) {
  if (url.startsWith('http')) {
    // Open external URL
    launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
  } else if (url.startsWith('#')) {
    // Handle anchor link
    scrollToSection(url.substring(1));
  } else {
    // Handle internal navigation
    Navigator.pushNamed(context, url);
  }
}

If not provided, links will be rendered but tapping them will have no effect.

Implementation

final void Function(String url)? onTapLink;