when<T> method
T
when<T>({
- required T local(),
- required T network(),
The when method is the equivalent to pattern matching. Its prototype depends on the AttachmentSource defined.
Implementation
// ignore: missing_return
T when<T>({
required T Function() local,
required T Function() network,
}) {
switch (this) {
case AttachmentSource.local:
return local();
case AttachmentSource.network:
return network();
}
}