Repository navigation
Conversation
Add optional flags to reader mode
Add option to specify `EXTRA_READER_PRESENCE_CHECK_DELAY` on Android
run `dart format`
Feature: add androidReaderModeFlags option to pollTag
`finish()` invalidates the session and clears `self.session`, but iOS can deliver that session's `didInvalidateWithError` after the next `poll()` has already begun a new session. The delegate ignored its session argument, so the stale callback passed the `result != nil` check, delivered 409 to the new poll, and then cleared `self.session` and `self.tag` — leaving the new session on screen with nothing able to finish it. Compare the invalidating session against `self.session` and return early when they differ. Behaviour for the current session is unchanged. The parameter is named `invalidatedSession` rather than `session` so it does not shadow the property the method body still assigns to. Fixes #232 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Core NFC delivers `didInvalidateWithError` on its own queue, while `poll()` and `finish()` change `session` and `result` on the main thread. With the two unsynchronised, a callback could pass the session identity check and then read `result` after `finish()` and a new `poll()` had already replaced it — the same stale-error outcome the check exists to prevent, in a narrower window. Dispatch the handler body to the main queue so the check and the state it guards happen in one step, ordered against those method calls. The body is otherwise unchanged; the `[self]` capture keeps the existing implicit property references compiling. Addresses review feedback on #235. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flutter 3.47 warns about plugins that apply the Kotlin Gradle Plugin and will fail such builds in a future release. Following Flutter's migration guide for plugin authors, the plugin no longer applies KGP; Flutter applies it when an app still has android.builtInKotlin=false. - Remove org.jetbrains.kotlin.android from the plugins block - Replace android.kotlinOptions with top-level kotlin.compilerOptions - Require Flutter >= 3.44 (needed for KGP 2.0 compilerOptions DSL) Tested with AGP 9.1 (builtInKotlin true and false), AGP 8.13 and the example app.
android: migrate to built-in Kotlin (AGP 9)
…dation fix(ios): ignore invalidation from a session that is no longer current
Update the package and example dependency constraints and lockfile for the current Dart and Flutter toolchains. Regenerate the JSON serializers with the upgraded json_serializable stack so numeric fields are decoded through num conversions and remain type safe. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Bump the Podspec metadata and align the Android build with AGP 9.0.1, Kotlin 2.3.20, and Gradle 9.2.1. Keep the example on Flutter's temporary legacy-KGP compatibility path until the stable Flutter toolchain includes the built-in Kotlin validation fix, and document the resulting platform requirements and release notes. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Add manual triggers, read-only permissions, and concurrency cancellation to the test and example workflows. Use Flutter-aware dependency installation, pin dartdoc for stable API documentation, and switch pub.dev publishing to dart pub commands with an explicit read permission. Keep Pana evaluation in the Linux CI matrix and make the analyzer ignore generated platform build directories. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Apply the current Dart formatter to the public API, web implementation, and WebUSB interop code. This keeps the sources and generated output compatible with the formatter check now enforced by CI without changing runtime behavior. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
AGP 9 optimized resource shrinking requires non-final resource IDs during release builds. Set the example application's android.nonFinalResIds flag to true so the APK release job can complete under R8. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Refresh checkout, Java setup, artifact upload, Flutter setup, and Dart setup actions to their current major releases. Keep the existing matrices, caches, permissions, and publishing behavior unchanged while using major tags for maintainable workflow references. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Callers must finish a polling session before starting another. No actionable issue remains that would prevent merging after normal checks. Pre-merge checks |
|
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is coherent and all available platform and validation checks pass, with only a minor API-documentation gap noted.
1 open finding
What changed in this PR
Prepares the cross-platform NFC plugin for release 3.7.0 with new Android polling controls, safer iOS session handling, and updated tooling.
Changes:
- Adds Android reader-mode flags and presence-check configuration.
- Prevents stale iOS session invalidations from affecting new polls.
- Updates SDK constraints, dependencies, Android tooling, documentation, and CI.
| File | Description |
|---|---|
README.md |
Updates requirements and Android optimization guidance. |
pubspec.yaml |
Bumps version, SDK constraints, and dependencies. |
lib/webusb_interop.dart |
Applies current Dart formatting. |
lib/flutter_nfc_kit.g.dart |
Regenerates JSON serializers. |
lib/flutter_nfc_kit.dart |
Adds Android polling options and formatting updates. |
lib/flutter_nfc_kit_web.dart |
Applies current Dart formatting. |
ios/flutter_nfc_kit/Sources/flutter_nfc_kit/FlutterNfcKitPlugin.swift |
Guards against stale session invalidations. |
ios/flutter_nfc_kit.podspec |
Updates the pod version. |
example/pubspec.yaml |
Updates example SDK and dependencies. |
example/pubspec.lock |
Refreshes resolved dependencies. |
example/android/gradle.properties |
Configures AGP 9 compatibility. |
CHANGELOG.md |
Documents releases 3.6.2 and 3.7.0. |
android/src/main/kotlin/im/nfc/flutter_nfc_kit/FlutterNfcKitPlugin.kt |
Passes reader flags and presence-check options. |
android/gradle.properties |
Updates AGP and Kotlin versions. |
android/build.gradle |
Migrates to built-in Kotlin configuration. |
analysis_options.yaml |
Excludes generated platform directories. |
.github/workflows/test.yml |
Hardens and updates validation CI. |
.github/workflows/publish.yaml |
Updates release publishing. |
.github/workflows/example-app.yml |
Updates example build CI. |
Files not reviewed (1)
- lib/flutter_nfc_kit.g.dart: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Explain that extraReaderPresenceCheckDelay is Android-only, controls the platform tag presence-check interval, uses a Duration, and falls back to the platform default when omitted. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>

Summary by CodeRabbit