Description
In summary, when calling the send
method on an Analytics
object, the payload will be logged to a file. However, like with any file I/O operation, there is a chance for it to fail and result in a FileSystemException
being thrown. Analytics.send
logging to a file is an implementation detail, so there's no way for a caller to anticipate this failing and handle it appropriately. The result is that any user of unified_analtyics is susceptible to unexpected crashes.
In particular, this has become one of the top crashers of the flutter
CLI tool (flutter/flutter#149196).
I suggest either 1) catching and discarding these errors (as I doubt logging analytics behavior is a critical activity) or 2) when appending to the file and an exception is encountered, flush old data from the log file and try to write again.