label-capture-flutter
Installation
SKILL.md
Label Capture Flutter Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit Label Capture APIs. The Flutter plugin surface (package names, builder API, plugin initialization, widget lifecycle) is distinct from the web, React Native, Cordova, and Capacitor SDKs.
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:
- Plugin must be initialized before any Scandit API call. Call
await ScanditFlutterDataCaptureLabel.initialize();(andawait ScanditFlutterDataCaptureBarcode.initialize();) beforeDataCaptureContext.initialize(licenseKey);. Skipping the plugininitialize()causes opaque MethodChannel errors at runtime. - Listener method names are iOS-style on Flutter. The Validation Flow uses
didCaptureLabelWithFields(fields),didSubmitManualInputForField(field, oldValue, newValue),didUpdateValidationFlowResult(...). Web names (onValidationFlowLabelCaptured,onManualInput) do not exist on Flutter. - Two listener interfaces exist.
LabelCaptureValidationFlowListenerdeclares onlydidCaptureLabelWithFields. To handle manual-input submissions or per-frame result updates, implementLabelCaptureValidationFlowExtendedListener(which extends the base listener withdidSubmitManualInputForFieldanddidUpdateValidationFlowResult). - Builder API on Flutter. Field definitions use builders:
CustomBarcodeBuilder().setSymbologies([...]).isOptional(false).build(name),LabelDefinitionBuilder().addCustomBarcode(...).addExpiryDateText(...).build(name),LabelCaptureSettings([labelDefinition]). This is opposite to RN/Cordova/Capacitor (which are class-based) — do not mix them up. - Camera permission is required on both iOS (
NSCameraUsageDescriptioninios/Runner/Info.plist) and Android (declared automatically; request at runtime with thepermission_handlerpackage). - The
DataCaptureViewis a Flutter widget; its lifecycle ties to the widget tree. Pause the camera indidChangeAppLifecycleState(viaWidgetsBindingObserver) and dispose listeners in the State'sdispose().
Product Guidance
Apply these rules whenever the user is making a design decision, not just an API question. They reflect how Scandit recommends Label Capture be integrated.