maybeWhen<T> method

T maybeWhen<T>({
  1. T? ban()?,
  2. T? invite()?,
  3. T? join()?,
  4. T? knock()?,
  5. T? leave()?,
  6. required T orElse(),
})

Implementation

T maybeWhen<T>({
  T? Function()? ban,
  T? Function()? invite,
  T? Function()? join,
  T? Function()? knock,
  T? Function()? leave,
  required T Function() orElse,
}) =>
    {
      Membership.ban: ban,
      Membership.invite: invite,
      Membership.join: join,
      Membership.knock: knock,
      Membership.leave: leave,
    }[this]
        ?.call() ??
    orElse();