Upgrade to version 2.0.0 with major changes including Dart SDK floor …#3
Upgrade to version 2.0.0 with major changes including Dart SDK floor …#3khushal-chothani wants to merge 2 commits into
Conversation
…raise, improved iOS Keychain handling, and added Swift Package Manager support. Updated README and documentation for clarity, and added tests for API stability. Removed legacy Android build files and migrated to Kotlin DSL for Gradle configuration.
|
You can test this package directly from this branch using a Git dependency: dependencies:
persistent_device_id:
git:
url: https://github.com/khushal-chothani/persistent_device_id.git
ref: mainAfter adding it to your app, run: flutter pub getThen use the existing API: final deviceId = await PersistentDeviceId.getDeviceId(); |
|
PR Review: persistent_device_id v2.0.0 ✅ StrengthsAPI Stability: Kept PersistentDeviceId.getDeviceId() as the stable public interface while improving internals through platform interfaces. Android Modernization: Migrated from Groovy to Kotlin DSL (build.gradle → build.gradle.kts) Added Swift Package Manager support with new Package.swift Significantly improved README with clearer guarantees and limitations Example App: Completely rewrote with better UX (loading states, error handling, copy-to-clipboard, refresh).
|
jpdup
left a comment
There was a problem hiding this comment.
Approved with comments, I also compiled against that PR branch.
Our App build and ran on iOS
|
@jpdup @maeltoukap I have one question regarding the Returning Would you be open to expanding this plugin by allowing users to provide or set their own unique fallback ID through a few additional APIs? For example, instead of changing the current PersistentDeviceId.setCustomDeviceId(String id)
PersistentDeviceId.clearCustomDeviceId()
PersistentDeviceId.getDeviceId()The reason I am suggesting this separately is that if we expand the current So I wanted to check how you would prefer to expand this plugin: Should we keep Or should the plugin internally handle fallback generation and storage when native ID retrieval fails? I’m happy to contribute the implementation based on your direction. |
|
I think you’re making the right trade-off for backward compatibility. Keeping the existing contract of returning null makes sense for now. The main decision point, in my view, is the 2.0.0 major release milestone. Once you reach that version, introducing breaking changes becomes much more reasonable, especially if it allows for a cleaner API, better abstractions, and overall codebase improvements. Ultimately, that decision is entirely up to you as the maintainer. Given that the Flutter/iOS ecosystem is currently undergoing a broader transition toward Swift Package Manager (SPM), I’d lean toward keeping the plugin as minimal and stable as possible in the short term. That approach reduces migration friction and avoids expanding the API surface prematurely. We can always revisit the contract in a future major release and decide whether automatic fallback generation/storage should become the default behavior once the Flutter/SPM landscape has settled a bit more. |
…oved error management. Updated Android and iOS implementations for better persistence, added migration from legacy storage, and refined documentation. Introduced new tests for various scenarios, ensuring stability and reliability across platforms.
|
I’ve addressed the recommended items:
Validation completed:
No custom ID setter or temporary Dart fallback was added. |
Description
Modernizes
persistent_device_idfor a publish-ready Android/iOS release while preserving the existing public API:This PR raises the package to version
2.0.0, updates the SDK/tooling floor, improves Android and iOS native implementations, adds Swift Package Manager support for iOS, refreshes package metadata/docs/tests, and updates the example app.Key changes include:
^3.11.0and Flutter>=3.41.0.PersistentDeviceId.getDeviceId()while routing it through the platform interface.getPlatformVersioncode/tests.1.1.0.MediaDrmrelease.package=namespace usage.PrivacyInfo.xcprivacyfor Apple privacy manifest support.2.0.0.Fixes # (issue)
Type of change
How Has This Been Tested?
Tested locally with Flutter stable
3.44.1and Dart3.12.1.The following commands were run successfully:
Test coverage includes:
Dart API stability for
PersistentDeviceId.getDeviceId().Platform interface delegation.
Method-channel forwarding.
Repeated calls returning the same stable ID in tests.
Nullable platform response handling.
Android native
getDeviceIdmethod handling.Android unknown method handling.
Example UI states for loaded, refreshed, null, and error flows.
Unit tests
Integration tests
Manual tests
Checklist:
Notes
This is a major release because the package SDK/tooling floor was raised.
Only Android and iOS are declared in this PR. Web, macOS, Windows, and Linux are intentionally not added yet because they require separate platform-specific persistence strategies and tests. Web support in particular cannot provide the same security or persistence guarantees as native storage.