handle method

  1. @visibleForTesting
Future<void> handle(
  1. Uri uri
)

Offer the URI to the developer's callback, then dispatch automatically when allowed. Visible for testing; production code goes through init / listen.

Implementation

@visibleForTesting
Future<void> handle(Uri uri) async {
  try {
    final Future<bool> Function(Uri uri)? callback =
        Nylo.instance.onIncomingLinkAction;
    if (callback != null) {
      final bool shouldRoute = await callback(uri);
      if (!shouldRoute) return;
    }
    _navigate(uri);
  } catch (e) {
    NyLogger.error(
      'Deep link handling failed',
      context: {'uri': uri.toString(), 'error': e.toString()},
    );
  }
}