Exactly like decode, just return null instead of throwing exceptions.
decode
null
static JWT? tryDecode(String token) { try { return decode(token); } catch (ex) { return null; } }