Description
Recently, when we added the error handling class to log errors we encounter within the package, we failed to consider the case when an error occurs on start up. Specifically, if the ~/.dart-tool/dart-flutter-telemetry-session.json
was malformed and was not valid json, we would encounter an error on start up.
And once we encounter this json parsing error, we properly handle it with our try/catch blocks in lib/src/session.dart
file. While handling this error, we attempt to send an event that indicates what happened during this error. This error occurs because we have logic that has been placed in the Session
class's constructor body.
We should instead move the logic that exists within the Session
class's constructor body into a separate method called Session.initialize
and only call that once we have ensured that all the necessary fields for Analytics
have been initialized already