A theoretical investigation of optical emission in solar flares