userId method

void userId({
  1. required String userId,
})

Sets a userId that persists throughout the app's lifecycle.

This applies to your possible _analyticsInterface as well as your _crashReportsInterface.

Implementation

void userId({required String userId}) {
  _eventBus.tryAddAnalytic(Loglytics._analyticsInterface?.setUserId(userId));
  _eventBus.tryAddCrashReport(
      Loglytics._crashReportsInterface?.setUserIdentifier(userId));
  _log?.analytic(
    name: 'user_id',
    value: userId,
    addToCrashReports: Loglytics._addAnalyticsToCrashReports,
  );
}