matrixscan-ar-flutter
Installation
SKILL.md
MatrixScan AR Flutter Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The BarcodeAr API changes between major SDK versions — class names, constructor signatures, provider interfaces, and the Flutter plugin import path have all evolved.
Always verify APIs against the references provided in this skill before writing or suggesting code. Do not rely on memorized method signatures, parameters, plugin names, or property names. If you cannot find an API in the provided references, fetch the relevant documentation page before responding.
Flutter-specific gotchas worth flagging:
await ScanditFlutterDataCaptureBarcode.initialize()must be called (and awaited) inmain()beforerunApp(...), afterWidgetsFlutterBinding.ensureInitialized(). Forgetting this yields a platform-channel error that can look unrelated to initialization.BarcodeArViewis a FlutterStatefulWidget. Create it once ininitState()(not inbuild()), store it as a field, and embed it in the widget tree. Creating it insidebuild()tears it down and rebuilds the native view on every rebuild.- The highlight and annotation providers (
BarcodeArHighlightProvider,BarcodeArAnnotationProvider) returnFuture<BarcodeArHighlight?>andFuture<BarcodeArAnnotation?>respectively. These callbacks are async — do not return plain values. BarcodeArCustomHighlightandBarcodeArCustomAnnotationuse FlutterWidgetchildren that are serialized as snapshots. Animated widgets are captured as a still frame at render time — they will not animate inside the AR overlay.- The BLoC (or equivalent controller) owns
DataCaptureContext,BarcodeAr, and the camera lifecycle. TheStateclass holds theBarcodeArViewand implements the provider interfaces. - Camera permission is required on both iOS (
NSCameraUsageDescriptioninios/Runner/Info.plist) and Android (runtime request viapermission_handler— the plugin declares the manifest permission automatically). - The barcode AR import is
scandit_flutter_datacapture_barcode_ar— a separate barrel file from the mainscandit_flutter_datacapture_barcodeimport. Symbologyenum values use lowerCamelCase in Dart:Symbology.code128,Symbology.ean13Upca,Symbology.code39,Symbology.qr,Symbology.dataMatrix. Do not writeSymbology.Code128/Symbology.EAN13UPCA— that's the JS/TS form and will not compile in Dart.