Skip to content
pubscout

credit_card_type_detector

3.0.0, released 4 years ago by an unverified publisher

Detects credit card types based on number patterns and IIN ranges.

WASM-readyUnverified publisher
$ flutter pub add credit_card_type_detector
Source repository

What it does

Detects credit card providers like Visa, Mastercard, and American Express by inspecting the current card number string. It supports custom card types and partial matches suitable for reactive text inputs.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building a credit card input form that needs to display the card brand dynamically as the user types.
  • You need to detect multiple potential card types for overlapping prefixes.

Skip it when

  • You need to fully validate credit card numbers (e.g., using the Luhn algorithm) rather than just detecting the brand.
  • You are processing payments directly rather than handling UI input detection.

Strengths

  • No external dependencies.
  • Supports partial matches for real-time UI updates while typing.
  • Allows creating and defining custom card types.

Weaknesses

  • Limited only to card type detection based on patterns without built-in payment processing or full validation logic.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:credit_card_type_detector/credit_card_type_detector.dart';

String visaStr = '4647 7200 6779 1032';
var types = detectCCType(visaStr);
assert(types.contains(CreditCardType.visa()));

Alternatives

Packages that do the same job and could replace credit_card_type_detector.

Works with

Packages commonly used together with credit_card_type_detector: ones it builds on, ones built on it, and its own family.