Imported from koji-1009/qr_scanner_view (
AGENTS.md). Install upstream withnpx skills add koji-1009/qr_scanner_view. Copyright stays with the author.
AGENTS.md
Flutter plugin: live QR / barcode scanning via a native PlatformView.
Three layers that must stay in sync — Dart (lib/), Kotlin (android/),
Swift (ios/).
Architecture invariants
- The wire contract (channel names, method names, map keys, enum string
values) spans all three languages.
lib/src/wire.dartowns the Dart side;android/.../QrScannerView.ktandios/.../QrScannerPlatformView.swiftmirror it. A change to any wire shape must be applied to all three layers. - Channel names derive from one prefix:
kViewType(wire.dart),QrScannerViewPlugin.VIEW_TYPE(Kotlin) andQrScannerViewPlugin.viewType(Swift). Build names from those constants, never as bare literals. - Only decoded values cross the platform channel. Payload parsing
(
ParsedValue) is Dart-only so both platforms behave identically. - The analyzer / metadata-delegate callbacks are per-frame hot paths; avoid adding allocations or channel traffic there.
Commands
- Dart:
flutter analyze/flutter test - Android native tests (also compiles the plugin Kotlin):
cd example/android && ./gradlew :qr_scanner_view:testDebugUnitTest - iOS native tests (also compiles the plugin Swift):
- in
example:flutter build ios --config-only --simulator - then in
example/ios:xcodebuild test -workspace Runner.xcworkspace -scheme Runner -destination 'platform=iOS Simulator,name=<iPhone>'
- in
- CI runs the same set:
.github/workflows/analyze.yml(Dart) and.github/workflows/build.yml(native)
Formatting
- Dart:
dart format . - Swift:
swift-formatdefault style (no config file), e.g.xcrun swift-format format --in-place ios/qr_scanner_view/Sources/qr_scanner_view/*.swift - Kotlin: IntelliJ / Android Studio default Kotlin style
Conventions
- Commits follow Conventional Commits 1.0.0 (https://www.conventionalcommits.org/en/v1.0.0/).
- The version lives in
pubspec.yaml,android/build.gradle.ktsandCHANGELOG.md; keep them in agreement and do not bump unless instructed. pubspec.lockis not committed (library package).- Comments: only what a maintainer needs — no fix narration, no spec references.