credit_card_type_detector_korean 0.2.0
credit_card_type_detector_korean: ^0.2.0 copied to clipboard
Recognizes card types through BIN numbers of domestic credit card issuers in Korea. This Flutter package extends the functionality of credit_card_type_detector, maintaining vendor detection while focu [...]
Credit Card Type Detector Korean #
Korean domestic credit-card BIN detector built on top of credit_card_type_detector.
Given a card number it returns matching entries from the official Korean BIN table (신용카드 BIN_Table), optionally combined with the international brand detected by the upstream package.
Installation 💻 #
❗ In order to start using Credit Card Type Detector Korean you must have the Dart SDK installed on your machine.
Install via dart pub add:
dart pub add credit_card_type_detector_korean
Usage 📖 #
import 'package:credit_card_type_detector_korean/credit_card_type_detector_korean.dart';
void main() {
final detector = CreditCardTypeDetectorKorean();
// ── Korean BIN lookup ────────────────────────────────────────
// Accepts any formatting — spaces, dashes, tabs are stripped automatically.
final bins = detector.detect('4599 2700 1234 5678');
// bins[0].cardIssuer == '현대카드'
// bins[0].brand == '비자'
// ── Combined Korean + international detection ────────────────
final result = detector.detectCard('4599270012345678');
// result.koreanBins — List<CardBinModel> (Korean issuer info)
// result.internationalTypes — List<CreditCardType> (Visa / Mastercard / …)
// ── Query helpers ─────────────────────────────────────────────
final shinhan = detector.findByIssuer(CARD_ISSUER_SHINHAN);
final visaCards = detector.findByBrand(TYPE_VISA_KO);
final creditCards = detector.findByCardType(CREDIT_CARD);
final corporate = detector.findByCorporate(CARD_TYPE_CORPORATE);
// ── Dataset freshness ─────────────────────────────────────────
// ISO 8601 release date of the bundled BIN table, so callers can tell how
// current their copy is.
print('BIN dataset revision: $datasetVersion'); // e.g. 2026-04-28
}
Regenerating the BIN dataset 🔄 #
The bundled BIN data (lib/src/data.dart) is generated from the upstream CSV published by KICC (Korea International Card & Commerce).
Where to download the CSV #
- Visit the KICC VAN support page:
- Find the latest 신용카드 BIN_Table … .xls entry and download it.
- Open the
.xlsfile in Excel (or a compatible tool) and export the 상세 sheet as a CSV (UTF-8) file. - Place the exported
.csvin the project root.
Running the generator #
When a new CSV is available, place it in the project root and run:
dart tool/generate_data.dart
The script auto-discovers any file matching *BIN_Table*.csv in the project
root and overwrites lib/src/data.dart. It also writes lib/src/dataset_version.dart, stamping the datasetVersion constant with the YYYYMMDD date parsed from the CSV file name. You can also pass the path explicitly:
dart tool/generate_data.dart path/to/신용카드\ BIN_Table\(20260428\).xls\ -\ 상세.csv
After regenerating, format the output so it matches what CI expects:
dart format lib/src/data.dart lib/src/dataset_version.dart
CI regenerates these two files from the committed CSV and fails if they differ from what is checked in, so the generated data can never silently drift from its source.
Continuous Integration 🤖 #
Credit Card Type Detector Korean comes with a built-in GitHub Actions workflow powered by Very Good Workflows but you can also add your preferred CI/CD solution.
Out of the box, on each pull request and push, the CI formats, lints, and tests the code. This ensures the code remains consistent and behaves correctly as you add functionality or make changes. The project uses Very Good Analysis for a strict set of analysis options used by our team. Code coverage is enforced using the Very Good Workflows.
Running Tests 🧪 #
To run all unit tests:
dart pub global activate coverage
dart test --coverage=coverage
dart run coverage:format_coverage \
--lcov \
--check-ignore \
--ignore-files="**/*.g.dart" \
--in=coverage \
--out=coverage/lcov.info \
--package=. \
--report-on=lib
To view the generated coverage report you can use lcov.
# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
open coverage/index.html