getCurrentUserDto method

Future<UserDto?> getCurrentUserDto(
  1. SchemaMetaData smd,
  2. DbTransaction transaction
)

Implementation

Future<UserDto?> getCurrentUserDto(
    SchemaMetaData smd, DbTransaction transaction) async {
  if (_currentUserDto == null) {
    UserDao userDao = UserDao(smd, transaction);
    await userDao.init(initTable: true);
    try {
      int? cuid = await getCurrentUserId(smd, transaction);
      _currentUserDto = await userDao.getUserDtoById(cuid!);
    } on SqlException catch (e) {
      if (e.sqlExceptionEnum == SqlExceptionEnum.FAILED_SELECT)
        print("WS $e");
      else
        rethrow;
    }
  }
  return _currentUserDto;
}