Dart π―
The official Dart client for the CardScan API provides support for Flutter, web, and server-side Dart applications.
Installation
Add to your pubspec.yaml:
dependencies:
cardscan_client: ^1.0.0Then run:
flutter pub get
# or for Dart-only projects
dart pub getBasic Usage
import 'package:cardscan_client/cardscan_client.dart';
// Initialize with your API key
final apiKey = 'sk_test_cardscan_ai_...';
final client = CardScanApi(apiKey: apiKey);
// Generate a session token for a user
Future<void> authenticate() async {
final tokenResponse = await client.getAccessToken(
userId: 'unique-user-123',
);
final sessionToken = tokenResponse['Token'];
final identityId = tokenResponse['IdentityId'];
final sessionId = tokenResponse['session_id'];
// Initialize client with session token for frontend operations
final userClient = CardScanApi(
sessionToken: sessionToken,
live: false, // Use sandbox
);
}Card Scanning Workflow
1. Create a Card
2. Generate Upload URL
3. Upload Image
4. Poll for Results
Error Handling
Flutter Integration
Camera Capture with image_picker
WebSocket Support
Eligibility Verification
State Management with Riverpod
Web Support
For Flutter Web, use the HTML file input:
Configuration
Testing
Source Code
View the source code and contribute: GitHub
Last updated
Was this helpful?