flagsmith-flutter-client icon indicating copy to clipboard operation
flagsmith-flutter-client copied to clipboard

Crashlytics reporting a crash when the user lost the internet connection

Open revtut opened this issue 1 year ago • 1 comments

Hi everyone,

When the enableAnalytics is enabled if the user had the app opened but out of the sudden lost the internet connection, the syncing method will throw an error that is not caught anywhere and thus reports a crash.

I believe that we should not throw the error and instead just log it. What do you think about it?

In the meantime, I'll disable the analytics to avoid any crashes.

https://github.com/Flagsmith/flagsmith-flutter-client/blob/284bab1dadf54e0782c89f3b1fa43a5c27e67fd1/lib/src/flagsmith_client.dart#L95

Screenshot 2024-08-02 at 10 22 15

revtut avatar Aug 02 '24 10:08 revtut

@revtut This makes sense to me - it would be consistent with what we're doing already for other SDKs. For example:

  • Node.js: https://github.com/Flagsmith/flagsmith-nodejs-client/blob/a2a3c1c997b5f9a7478627ae7029577667fc6555/sdk/analytics.ts#L54-L58
  • Java: https://github.com/Flagsmith/flagsmith-java-client/blob/9f506f41007b21b7f0a90dcaa12069a7245fe581/src/main/java/com/flagsmith/threads/AnalyticsProcessor.java#L127-L135
  • Android: https://github.com/Flagsmith/flagsmith-kotlin-android-client/blob/c49f0884eea59775e6ce4395bd05a2ce3f45d7df/FlagsmithClient/src/main/java/com/flagsmith/internal/FlagsmithAnalytics.kt#L25-L30

Not all SDKs do this but it does seem like a reasonable default. @revtut would you be okay to send us a PR for this?

rolodato avatar Aug 02 '24 23:08 rolodato