map<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- _UnspeccedGetTrendingTopicsOutput value
A switch
-like method, using callbacks.
Callbacks receives the raw object, upcasted. It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case final Subclass2 value:
return ...;
}
Implementation
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _UnspeccedGetTrendingTopicsOutput value) $default,){
final _that = this;
switch (_that) {
case _UnspeccedGetTrendingTopicsOutput():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}