onMessageLinkTap function

Future<void> onMessageLinkTap(
  1. Uri uri,
  2. dynamic ref,
  3. dynamic context
)

Implementation

Future<void> onMessageLinkTap(
  Uri uri,
  WidgetRef ref,
  BuildContext context,
) async {
  try {
    await handleDeepLinkUri(
      context: context,
      ref: ref,
      uri: uri,
      throwNoError: true,
    );
  } on UriParseError {
    if (!context.mounted) {
      return;
    }
    final roomId = getRoomIdFromLink(uri);

    ///If link is type of matrix room link
    if (roomId != null) {
      goToChat(context, roomId);
    }

    ///If link is other than matrix room link
    ///Then open it on browser
    else {
      await openLink(uri.toString(), context);
    }
  }
}