An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

        

# Flutter Cardidy
[![pub package publisher](https://img.shields.io/badge/pub.dev-01579b.svg?style=flat-square&logo=dart&logoColor=white)](https://pub.dev/publishers/hey24sheep.com/packages)
[![pub package](https://img.shields.io/pub/v/flutter_cardidy.svg?style=flat-square)](https://pub.dartlang.org/packages/flutter_cardidy)
[![GitHub Stars](https://img.shields.io/github/stars/hey24sheep/flutter_cardidy.svg?style=flat-square&logo=github)](https://github.com/hey24sheep/flutter_cardidy)
[![Flutter Tests](https://github.com/hey24sheep/flutter_cardidy/actions/workflows/dart.yml/badge.svg?branch=master)](https://github.com/hey24sheep/flutter_cardidy/actions/workflows/dart.yml)

Buy Me A Coffee

**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)