logUserInfo method

Future<void> logUserInfo(
  1. UserInfo? userInfo
)
override

Implementation

Future<void> logUserInfo(UserInfo? userInfo) async {
  if (userInfo == null) return;
  if (userInfo.department != null && userInfo.department!.isNotEmpty) {
    await analytics?.logEvent(
      name: 'user_info',
      parameters: <String, dynamic>{
        AnalyticsConstants.department: userInfo.department,
      },
    );
    FirebaseAnalyticsUtils.instance.setUserProperty(
      AnalyticsConstants.department,
      userInfo.department,
    );
  }
  if (userInfo.className != null && userInfo.className!.isNotEmpty) {
    FirebaseAnalyticsUtils.instance.setUserProperty(
      AnalyticsConstants.className,
      userInfo.className,
    );
  }
  if (userInfo.id.isNotEmpty) {
    await analytics?.setUserId(id: userInfo.id);
    FirebaseAnalyticsUtils.instance.setUserProperty(
      AnalyticsConstants.studentId,
      userInfo.id,
    );
  }
  debugPrint('logUserInfo succeeded');
}