Skip to content

Release 3.7.0 - #238

Merged
dangfan merged 23 commits into
masterfrom
develop
Oct 11, 2026
Merged

dangfan merged 23 commits into
masterfrom
develop

Conversation

@Harry-Chen

@Harry-Chen Harry-Chen commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Android NFC polling now supports custom reader-mode flags and an optional extra presence-check delay.
  • Bug Fixes
    • Improved handling of iOS NFC session invalidation and numeric values returned when reading tag data.
  • Documentation
    • Added Android reader-mode guidance and updated platform requirements and release notes.
  • Chores
    • Updated the minimum supported Dart and Flutter versions and refreshed build and publishing workflows.

robertpoll and others added 22 commits November 23, 2025 14:56
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>
Combine the unreleased 3.6.3 and 3.6.4 work into the next minor release.

Document the merged iOS session fix from PR #235, the AGP 9 built-in Kotlin migration from PR #236, the dependency and tooling updates, and the AGP 9 release-shrinking fix.

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>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 10:15
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 68281814-c7a9-4a98-81c1-e4334ac6a0a9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9e4a624f-e963-4326-82bd-282cf9d0baef


📥 Commits

Reviewing files that changed from the base of the PR and between fd35f4d and bc9d9b9.



⛔ Files ignored due to path filters (1)
  • example/pubspec.lock is excluded by !**/*.lock


📒 Files selected for processing (18)
  • .github/workflows/example-app.yml
  • .github/workflows/publish.yaml
  • .github/workflows/test.yml
  • CHANGELOG.md
  • README.md
  • analysis_options.yaml
  • android/build.gradle
  • android/gradle.properties
  • android/src/main/kotlin/im/nfc/flutter_nfc_kit/FlutterNfcKitPlugin.kt
  • example/android/gradle.properties
  • example/pubspec.yaml
  • ios/flutter_nfc_kit.podspec
  • ios/flutter_nfc_kit/Sources/flutter_nfc_kit/FlutterNfcKitPlugin.swift
  • lib/flutter_nfc_kit.dart
  • lib/flutter_nfc_kit.g.dart
  • lib/flutter_nfc_kit_web.dart
  • lib/webusb_interop.dart
  • pubspec.yaml


Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

The 3.7.0 update adds Android reader-mode options to poll(), changes iOS session invalidation handling, updates Android and package requirements, and revises CI and publishing workflows.

Changes

Package release and platform updates

Layer / File(s) Summary
Android reader-mode polling options
lib/flutter_nfc_kit.dart, android/src/main/kotlin/im/nfc/flutter_nfc_kit/FlutterNfcKitPlugin.kt, README.md, CHANGELOG.md
poll() accepts optional Android reader-mode flags and an extra presence-check delay. The Android plugin combines supplied flags with technology flags and passes reader-mode options to enableReaderMode.
iOS session invalidation handling
ios/flutter_nfc_kit/Sources/flutter_nfc_kit/FlutterNfcKitPlugin.swift
Invalidation handling runs on the main queue and checks that the callback belongs to the current session and that a result is pending before handling errors or clearing state.
Android build and package requirements
android/build.gradle, android/gradle.properties, example/android/gradle.properties, pubspec.yaml, example/pubspec.yaml, ios/flutter_nfc_kit.podspec, analysis_options.yaml, README.md, CHANGELOG.md
Android build configuration and example settings use updated AGP and Kotlin versions. Package and example SDK constraints and dependencies are updated. The README and changelog describe revised requirements and release notes.
Data handling and Dart/Web cleanup
lib/flutter_nfc_kit.g.dart, lib/flutter_nfc_kit.dart, android/src/main/kotlin/im/nfc/flutter_nfc_kit/FlutterNfcKitPlugin.kt, lib/flutter_nfc_kit_web.dart, lib/webusb_interop.dart
Generated deserialization converts numeric values to integers for specified fields. Other listed edits reformat existing code; the Android null handling and Web error codes retain their described outcomes.
CI and publishing workflows
.github/workflows/example-app.yml, .github/workflows/test.yml, .github/workflows/publish.yaml
The workflows add manual dispatch, permissions, concurrency settings, and updated actions. The test workflow changes package installation and documentation generation. The publish workflow uses dart pub publish.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant FlutterNfcKit.poll
  participant MethodChannel
  participant FlutterNfcKitPlugin
  participant NFCAdapter
  Caller->>FlutterNfcKit.poll: provide reader-mode flags and optional delay
  FlutterNfcKit.poll->>MethodChannel: send poll arguments
  MethodChannel->>FlutterNfcKitPlugin: deliver poll request
  FlutterNfcKitPlugin->>NFCAdapter: enableReaderMode with combined flags and options
Loading


Merge Risk: ⚪ Minimal · up to bc9d9

Callers must finish a polling session before starting another. No actionable issue remains that would prevent merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (16 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the primary change as the 3.7.0 release. It is concise and directly related to the version, changelog, dependency, and platform updates.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


Full details: Docstring Coverage

Explanation

Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (16 skipped: 16 unsupported.)




✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR



🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

Comment thread lib/flutter_nfc_kit.dart Resolved
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>
@dangfan
dangfan merged commit aa647c5 into master Oct 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants