onTapUrl method Null safety

Future<bool> onTapUrl(
  1. String url
)

Handles user tapping a link.

Implementation

Future<bool> onTapUrl(String url) async {
  final handledViaCallback = await onTapCallback(url);
  if (handledViaCallback) {
    return true;
  }

  if (url.startsWith('#')) {
    final id = url.substring(1);
    final handledViaAnchor =
        await onTapAnchor(id, _anchorRegistry.ensureVisible);
    if (handledViaAnchor) {
      return true;
    }
  }

  return false;
}