maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult mobile(
    1. NetworkTypeMobile value
    )?,
  2. TResult mobileRoaming(
    1. NetworkTypeMobileRoaming value
    )?,
  3. TResult none(
    1. NetworkTypeNone value
    )?,
  4. TResult other(
    1. NetworkTypeOther value
    )?,
  5. TResult wiFi(
    1. NetworkTypeWiFi value
    )?,
  6. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(NetworkTypeMobile value)? mobile,
  TResult Function(NetworkTypeMobileRoaming value)? mobileRoaming,
  TResult Function(NetworkTypeNone value)? none,
  TResult Function(NetworkTypeOther value)? other,
  TResult Function(NetworkTypeWiFi value)? wiFi,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case NetworkTypeMobile.constructor:
      if (mobile != null) {
        return mobile.call(this as NetworkTypeMobile);
      }
      break;
    case NetworkTypeMobileRoaming.constructor:
      if (mobileRoaming != null) {
        return mobileRoaming.call(this as NetworkTypeMobileRoaming);
      }
      break;
    case NetworkTypeNone.constructor:
      if (none != null) {
        return none.call(this as NetworkTypeNone);
      }
      break;
    case NetworkTypeOther.constructor:
      if (other != null) {
        return other.call(this as NetworkTypeOther);
      }
      break;
    case NetworkTypeWiFi.constructor:
      if (wiFi != null) {
        return wiFi.call(this as NetworkTypeWiFi);
      }
      break;
  }
  return orElse.call();
}