isCreditCard function

bool isCreditCard(
  1. String str
)

Checks if the string is a valid credit card number.

Strips hyphens and spaces before validating using the Luhn algorithm.

Example:

isCreditCard('4111111111111111'); // true
isCreditCard('1234567890123456'); // false

Implementation

bool isCreditCard(String str) => _isCreditCard(str);