cardIcon function

String cardIcon({
  1. required String number,
})

Card Icon

Type: String

This takes the card number, and uses the detectCardType function to to check the card type and returns an assets URL for the card company image Card Icon

Implementation

String cardIcon({required String number}) {
  switch (detectCardType(number: number)) {
    case FMCardType.amex:
      return "images/amex.png"; // American Express
    case FMCardType.chip:
      return "images/chip.png"; // Chip
    case FMCardType.diners:
      return "images/diners.png"; // Diners
    case FMCardType.discover:
      return "images/discover.png"; // Discover
    case FMCardType.elo:
      return "images/elo.png"; // Elo
    case FMCardType.hipercard:
      return "images/hipercard.png"; // Hipercard
    case FMCardType.jcb:
      return "images/jcb.png"; // JCB
    case FMCardType.maestro:
      return "images/maestro.png"; // Maestro
    case FMCardType.mastercard:
      return "images/mastercard.png"; // Mastercard
    case FMCardType.mir:
      return "images/mir.png"; // Mir
    case FMCardType.unionpay:
      return "images/unionpay.png"; // Unionpay
    case FMCardType.visa:
      return "images/visa.png"; // Visa
  }
}