flutter_ondevice_kyc library
On-device KYC scanning. The scan path does not open a socket or write an image.
Classes
- Detection
- DetectionClass
- DetectionLabels
- IcaoSamples
- Fictional ICAO specimen. Not a real person.
- KycCapture
- Fields emitted only after Luhn or ICAO 9303 accepts the frame.
- KycScanner
- Two-stage scan. A checksum miss is ScanRejected, never an exception.
- KycScanView
- Live back-camera scan. The host supplies a configured KycScanner.
- ManualCheckResult
- MrzData
- Point2
- Quad
- RawCameraFrame
- RawPlane
- RgbImage
- Tightly packed RGB image. Three bytes per pixel, row-major, no padding.
- ScanDecision
- One processed frame. Skipped frames are not failures.
- ScanLocked
- ScanObservation
- Timing note safe to log. It never carries a PAN or an MRZ line.
- ScanRejected
- ScanSkipped
- SyntheticCardSpec
- Bright card on a black field. Aspect is 240/152 ≈ 1.58, inside the ID-1 range.
Enums
- KycExecutionProvider
- MrzFormat
- ICAO 9303 machine-readable zone parser for TD1, TD2, and TD3.
- RawFrameLayout
- RejectReason
Functions
-
analysisTurns(
{required int bufferWidth, required int bufferHeight, required int sensorOrientation}) → int - CameraX sometimes delivers an already-portrait buffer. Rotating that again lays the MRZ on its side, so the three lines never separate.
-
checkManual(
{String mrz = '', String pan = '', String expiry = ''}) → ManualCheckResult - Checks whatever the operator pasted. A miss returns a reason and no capture.
-
extractExpiry(
String text) → String? -
Month/year as printed on a card,
MM/YY. Invalid months are rejected. -
extractPan(
String text) → String? -
The digit run in
textthat satisfies Luhn, or null. -
guideCrop(
Size view, Size image) → GuideCrop - Maps the on-screen guide back into an upright camera image, in 0–1 space.
-
hasPanCandidate(
String text) → bool -
True when
textcontains a 13–19 digit run, whether or not Luhn passes. -
icaoCheckDigit(
String field) → int? - Check digit for an MRZ field. Weights repeat 7, 3, 1.
-
idGuideRect(
Size view) → Rect - Horizontal ID-1 window, centered in the viewfinder.
-
luhnValid(
String raw) → bool - Luhn check for a primary account number of 13 to 19 digits.
-
mrzFocusPoint(
Size view) → Offset - Where autofocus should sit: the MRZ band inside the on-screen guide.
-
parseMrz(
String raw) → MrzData? - Parses TD1 (3×30), TD2 (2×36), or TD3 (2×44). Returns null when the line shape is not an MRZ. A shaped MRZ with a bad check digit is returned with MrzData.isValid false.
-
rawFromCameraImage(
CameraImage image, {required int sensorOrientation, GuideCrop? crop, bool framed = false}) → RawCameraFrame? - Copies a camera buffer into a RawCameraFrame the scanner can rotate and crop.
-
redactPan(
String pan) → String - Masks a PAN for logs and secondary UI. The host still receives the full number on the capture so it can fill a form.
-
rejectLabel(
RejectReason reason) → String -
tcknValid(
String raw) → bool - Turkish national id checksum (11 digits, first digit not zero).