Generalized equality check to simplify type checking.
This method allows for a cleaner way of comparing types
bool equals(Type type) => this == Type || this == type || runtimeType == type;