cast<T> method
Safely extracts the wrapped pointer back to its real object securely validating type T.
Extremely robust and strictly type-safe natively.
Implementation
T cast<T>() {
if (!_hasValue) {
throw StateError('Cannot deeply cast an absolutely empty Any object.');
}
if (_value is! T) {
throw TypeError();
}
return _value as T;
}