fromString static method

PaymentMethod fromString(
  1. String name
)

Implementation

static PaymentMethod fromString(String name) {
  switch (name.toUpperCase()) {
    case "CARD":
      return PaymentMethod.card;
    case "SWISH":
      return PaymentMethod.swish;
    case "CASH":
      return PaymentMethod.cash;
    default:
      throw Exception('No payment method found for $name');
  }
}