getCustomClaim<T> method
Returns a specific custom claim by key.
Parameters:
key- The claim key to retrievedefaultValue- The default value to return if the claim doesn't exist
Returns the claim value if found, otherwise returns defaultValue.
Implementation
T? getCustomClaim<T>(String key, {T? defaultValue}) {
final claims = getCustomClaims();
if (claims == null) return defaultValue;
final value = claims[key];
if (value is T) return value;
return defaultValue;
}