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.
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.
- flutter_multi_formatter
Input formatters for international phone numbers, credit/debit cards, currencies, and custom masks.
75Compare - fancy_credit_card_input
A highly customizable credit card input field with built-in animations and card brand detection.
74Compare - flutter_intl_phone_field
International phone number input with country picker, formatting, and validation for 250+ countries.
76Compare - best_form_validator
Zero-initialization form field validators for Flutter with 52 countries and 25 languages.
72Compare
Works with
Packages commonly used together with credit_card_type_detector: ones it builds on, ones built on it, and its own family.