tryParse static method
Parses uri, returning a ChatInviteLink when both the roomParam
and tokenParam query parameters are present and non-empty, or null
otherwise (so callers can if (link != null) straight onto the join).
Implementation
static ChatInviteLink? tryParse(
Uri uri, {
String roomParam = 'room',
String tokenParam = 'token',
}) {
final roomId = uri.queryParameters[roomParam];
final token = uri.queryParameters[tokenParam];
if (roomId == null || roomId.isEmpty || token == null || token.isEmpty) {
return null;
}
return ChatInviteLink(roomId: roomId, token: token);
}