https://github.com/hey24sheep/flutter_cardidy
An unofficial Flutter port of Cardidy, a package to validate or identify card numbers & cvv with ease.
https://github.com/hey24sheep/flutter_cardidy
card-validator credit-card credit-card-validation creditcard-validator dart flutter flutter-apps flutter-package flutter-plugin
Last synced: about 2 months ago
JSON representation
An unofficial Flutter port of Cardidy, a package to validate or identify card numbers & cvv with ease.
- Host: GitHub
- URL: https://github.com/hey24sheep/flutter_cardidy
- Owner: hey24sheep
- License: mit
- Created: 2021-11-15T18:30:58.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-12T06:00:38.000Z (over 1 year ago)
- Last Synced: 2025-01-29T23:29:11.942Z (4 months ago)
- Topics: card-validator, credit-card, credit-card-validation, creditcard-validator, dart, flutter, flutter-apps, flutter-package, flutter-plugin
- Language: Dart
- Homepage:
- Size: 29.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Flutter Cardidy
[](https://pub.dev/publishers/hey24sheep.com/packages)
[](https://pub.dartlang.org/packages/flutter_cardidy)
[](https://github.com/hey24sheep/flutter_cardidy)
[](https://github.com/hey24sheep/flutter_cardidy/actions/workflows/dart.yml)**A plugin to validate or identify card numbers & cvv with ease.**
This flutter package will help you validate **card numbers or CVVs** and identiy **card issuing provider** with **minimal code and efforts**.
- **simple and easy**
- **regex-free**
- **up-to-date with Wikipedia**
- **no other dependencies**
- **well documented**
- **production-ready**### This package is a Flutter port of original package [Cardidy](https://github.com/d-edge/Cardidy) written in C#.
> NOTE: The closer we are to an official spec is the Wikipedia's Payment card number page.
## Installation
```dart
dependencies:
flutter_cardidy: ^1.0.0
```## Getting Started
Add the dependency to your project and start using **Flutter Cardidy** everywhere:
Import the package.
```dart
import 'package:flutter_cardidy/flutter_cardidy.dart';
```To validate and identify card's issuing provider
```dart
// single card number identification
final result = FlutterCardidy.identify("4127540509730813");
Console.WriteLine(result.first); // print Visa
```Multi card identification
```dart
// returns a KVP Map of, cardnum as key & result as value
final mapResult = FlutterCardidy.identifyMultiple(["4127540509730813","4771320594031"]);
```Validating CVV
```dart
var cvv = "123";
var visaCvvIsValid = FlutterCardidy.isCvvValid(cvv, CardType.Visa);
```Validating card number without identification
```dart
var isCardValid = FlutterCardidy.isCardNumberValid("47!Z320594033");
```## Properties
> Return type of `Identify` is `List`. A card is sometimes a co-branded card like Visa or Visa Electron, in this case all matching providers are returned.
| Property | Type | Default | Note |
|-------------------------- |:------: |:-------: |------------------------------------------------------------------------------------------------------------------------------------: |
| cardNumString (required) | String | - | Your card number input string |
| validateLength | bool | true | Validate the length as part of the String identification.
A false value can be useful to identify the fragment of a card number. |
| ignoreNoise | bool | false | Ignore common noise found in card number. This noise is any of `- .`. |
| handleAnonymization | bool | false | Set any non-digits to zero. It is common to use "X" and "#" to hide some digits. |## Improve
Help me by reporting bugs, **submit new ideas** for features or anything else that you want to share.
- Just [write an issue](https://github.com/hey24sheep/flutter_cardidy/issues) on GitHub. ✏️
- And don't forget to hit the **like button** for this package ✌️## More
Check out my other useful packages on [pub.dev](https://pub.dev/publishers/hey24sheep.com/packages)
## License
[MIT](https://github.com/hey24sheep/flutter_cardidy/blob/master/LICENSE)