Flutter library for scanning insurance cards.

Features

Adds a widget which scans insurance cards using the device's camera.

Getting started

Android camera permissions

Add the following line to your AndroidManifest.xml file:

<key>NSCameraUsageDescription</key>
<string>To scan cards please grant camera access</string>

iOS camera permissions

Add the following lines to your Info.plist file:

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

Usage

CardScanner

Use it on your custom screens like any other widget:

class ScannerWidgetScreen extends StatelessWidget {
  const ScannerWidgetScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Scanner widget'),
      ),
      body: CardScanner(
        sessionToken: 'pass your token here',
        onCardScanSuccess: (card) {
          print('Scan success');
        },
        onCardScanError: (message) {
          print(message ?? 'Scan error');
        },
        onWebViewLoadError: () {
          print('WebView load error');
        },
        onCardScanCancel: () {
          Navigator.of(context).pop();
        },
      ),
    );
  }
}

CardScannerModal

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

Navigator.of(context).push(
  CardScanModal(
    sessionToken: 'pass your token here',
    onCardScanSuccess: (card) {
      print('Scan success');
    },
    onCardScanError: (message) {
      print(message ?? 'Scan error');
    },
    onWebViewLoadError: () {
      print('WebView load error');
    },
    onCardScanCancel: () {
      Navigator.of(context).pop();
    },
  ),
);

Libraries

card_mapper
card_response_model
card_scanner
card_scanner_modal
insurance_card_scanner
scanned_card