Description
Description:
I'm using cloud_firestore: ^5.4.0
and Flutter stable channel 3.24.2
, and I have encountered an issue where the enablePersistence()
method is marked as deprecated, but it is still required for web-based Flutter apps.
Issue:
- The method
enablePersistence()
is marked as deprecated in the latest version ofcloud_firestore
. - However, as per the official documentation, it is still necessary to use this method to enable offline persistence for web.
- There is currently no alternative approach for enabling persistence on web platforms. Using a deprecated method can cause confusion, especially since
Settings.persistenceEnabled
only works for non-web platforms.
Suggestion:
Ideally, web should follow the same persistence system as the rest of the platforms. But until that is feasible, a dedicated method like enablePersistenceForWeb()
should be introduced to:
- Avoid using a deprecated method on web.
- Clearly differentiate web-specific persistence behavior.
- Prevent confusion and the need for developers to use
// ignore: deprecated_member_use
, which would hide the moment when web persistence truly becomes deprecated with this method.
Using // ignore: deprecated_member_use
forces web developers to ignore the deprecation warning, making it difficult to know when the proper system for web has been implemented and when the method should no longer be used.
Steps to Reproduce:
- Use
cloud_firestore: ^5.4.0
in a Flutter app targeting web. - Attempt to implement offline persistence using
Settings.persistenceEnabled
. - Observe that the method is deprecated but still required for web, leading to confusion.
Expected Behavior:
- Either a dedicated method (
enablePersistenceForWeb()
) should be introduced, or the deprecation should be removed for web-based usage. - Web developers should have a clear and non-deprecated method to enable offline persistence until web can share the same persistence system as other platforms.
This approach would enhance clarity, prevent misuse of deprecated methods, and help web developers anticipate the proper transition when the persistence system is unified across platforms.