In the optically thin regime, the intensity ratio of the two Si IV resonance lines (1394 and 1403 Å) are theoretically the same as the ratio of their oscillator strengths, which is exactly 2. Here, we study the ratio of the integrated intensity of the Si IV lines (R = I 1394 (λ)dλ/ I 1403 (λ)dλ) and the ratio of intensity at each wavelength point (r(∆λ) = I 1394 (∆λ)/I 1403 (∆λ)) in two solar flares observed by the Interface Region Imaging Spectrograph. We find that at flare ribbons, the ratio R ranges from 1.8 to 2.3 and would generally decrease when the ribbons sweep across the slit position. Besides, the distribution of r(∆λ) shows a descending trend from the blue wing to the red wing. In loop cases, the Si IV line presents a wide profile with a central reversal. The ratio R deviates little from 2, but the ratio r(∆λ) can vary from 1.3 near the line center to greater than 2 in the line wings. Hence we conclude that in flare conditions, the ratio r(∆λ) varies across the line, due to the variation of the opacity at the line center and line wings. We notice that, although the ratio r(∆λ) could present a value which deviates from 2 as a result of the opacity effect near the line center, the ratio R is still close to 2. Therefore, caution should be taken when using the ratio of the integrated intensity of the Si IV lines to diagnose the opacity effect.