map<TResult extends Object?> method
TResult
map<TResult extends Object?>({
- required TResult android(
- AndroidPlatform value
- required TResult ios(
- IosPlatform value
- required TResult macos(
- MacosPlatform value
- required TResult web(
- WebPlatform value
- required TResult linux(
- LinuxPlatform value
- required TResult windows(
- WindowsPlatform value
- required TResult fuchsia(
- FuchsiaPlatform 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?>({
required TResult Function(AndroidPlatform value) android,
required TResult Function(IosPlatform value) ios,
required TResult Function(MacosPlatform value) macos,
required TResult Function(WebPlatform value) web,
required TResult Function(LinuxPlatform value) linux,
required TResult Function(WindowsPlatform value) windows,
required TResult Function(FuchsiaPlatform value) fuchsia,
}) {
final _that = this;
switch (_that) {
case AndroidPlatform():
return android(_that);
case IosPlatform():
return ios(_that);
case MacosPlatform():
return macos(_that);
case WebPlatform():
return web(_that);
case LinuxPlatform():
return linux(_that);
case WindowsPlatform():
return windows(_that);
case FuchsiaPlatform():
return fuchsia(_that);
}
}