flutter_card_io 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 30

CardIO plugin for flutter #

A Flutter plugin for iOS and Android for scanning credit cards using the camera. This uses the CardIO library for iOS and Android

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and pull requests are welcome!

Installation #

First, add flutter_card_io as a dependency in your pubspec.yaml file.

iOS #

Add the following key to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

NSCameraUsageDescription - Set the value to be a string describing why your app needs to use the camera (e.g. "To scan credit cards."). This string will be displayed when the app initially requests permission to access the camera.

Android #

Add the following permission to your Android Manifest, located in `

<uses-permission android:name="android.permission.CAMERA"/>

Add card.io's open source license acknowledgments to your app's acknowledgments.

Example #

  Map<String, dynamic> details = await FlutterCardIo.scanCard({
    "requireExpiry": true,
    "scanExpiry": true,
    "requireCVV": true,
    "requirePostalCode": true,
    "restrictPostalCodeToNumericOnly": true,
    "requireCardHolderName": true,
    "scanInstructions": "Hola! Fit the card within the box",

Response #

    "cardholderName": "John doe",
    "cardNumber": "1234 5678 9876 1236",
    "redactedCardNumber": "**** **** **** 1236",
    "expiryMonth": 12,
    "expiryYear": 2022,
    "cvv": 123,
    "postalCode": "93748"

[0.0.3] - Return cardType.

  • Return credit card type

[0.0.2] - Updated readme.

  • Update readme so it looks good on pub.dartlang.org

[0.0.1] - Initial release.

  • Add android and iOS sdk


import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_card_io/flutter_card_io.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  Map<String, dynamic> _data = {};

  initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  _scanCard() async {
    Map<String, dynamic> details;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      details = await FlutterCardIo.scanCard({
        "requireExpiry": true,
        "scanExpiry": true,
        "requireCVV": true,
        "requirePostalCode": true,
        "restrictPostalCodeToNumericOnly": true,
        "requireCardHolderName": true,
        "scanInstructions": "Hola! Fit the card within the box",

    } on PlatformException {

    if (details == null) {

    if (!mounted) return;

    setState(() {
      _data = details;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('CardIO sample app'),
        body: new Column(
          children: <Widget>[
            new Column(
              children: _data.keys.map((String key) {
                return new Text(_data[key].toString());
            new Container(
              margin: new EdgeInsets.all(30.0),
              child: new Center(
                child: new RaisedButton(
                  child: new Text("Scan"),
                  onPressed: _scanCard,

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_card_io: ^0.0.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_card_io/flutter_card_io.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0