Our CardScanner Flutter widget makes it easy to add insurance card scanning to any Flutter application in 5 minutes or less.


Android iOS
Support 5.0+ 12.0+


Add the insurance_card_scanner package to your pubspec.yaml file.

    sdk: flutter
  insurance_card_scanner: ^1.0.1

Or, run the following command:

$ flutter pub add insurance_card_scanner


Import the library widget into your project files:

import 'package:insurance_card_scanner/insurance_card_scanner.dart';

You can optionally add the API client for more custom applications.

import 'package:insurance_card_scanner/insurance_card_scanner_api.dart';

This package relies on the CardScan AI for scanning and capturing data from insurance cards. For complete understand of package setup and usage, you can refer to the package docs.

For a list of steps for configuring insurance card scanner, see the example app README.

Getting started

Android camera permissions

Add the following line to your AndroidManifest.xml file:

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

iOS camera permissions

Add the following lines to your Info.plist file:

<string>Your description of why you need access to camera</string>

Sandbox API Keys

Create a free account on the dashboard to generate a sandbox API key.

Basic examples

CardScanner widget

Use it on your custom screens like any other widget:

import 'package:insurance_card_scanner/insurance_card_scanner.dart';

class ScannerWidgetScreen extends StatelessWidget {
  const ScannerWidgetScreen({super.key});

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Scanner widget'),
      body: CardScanner(
        properties: CardScanConfig(
          sessionToken: '<pass your token here>',
          onSuccess: (card) {
            print('Scan success');
          onError: (message) {
            print(message ?? 'Unknown Scan error');
          onCancel: () {

CardScannerModal widget

Push it using Navigator to open a full-screen scanner.

    properties: CardScanConfig(
      sessionToken: 'pass your token here',
      onSuccess: (card) {
        print('Scan success');
      onError: (message) {
        print(message ?? 'Scan error');
      onCancel: () {

Available Properties

Both CardScanner and CardScannerModal should be passed a CardScanConfig instance with properties for server connection, callback handling and UI customization.

  // Required
  sessionToken: token,
  onSuccess: onSuccess,

  // Recommended
  onCancel: onCancel,
  onError: onError,
  live: live,

  // Optional
  backsideSupport: scanBackside,
  onRetry: onRetry,
  onWebViewLoadError: onWebViewLoadError,

  // UI Customization
  messages: messages,
  messageStyle: messagesStyle,
  autoSwitchActiveColor: autoSwitchActiveColor,
  autoSwitchInactiveColor: autoSwitchInactiveColor,
  progressBarColor: progressBarColor,
  widgetBackgroundColor: widgetBackgroundColor,


CardScan supports authentication for two different kinds of use cases:

  • Server-to-server - backend systems, admin portals, etc.
  • End User - a patient or clinician most likely on mobile or the web.

For detailed information on authentication and generating a JSON Web Token (JWT), check out the authentication docs.

Official documentation

For a complete understanding of package setup and usage, you can refer to the package docs.


This library eases the process for obtaining insurance card's data.