Numerical analysis of the flow was performed using the Comsol 5.6 software with the laminar flow module. The EC response was modelled using the electrochemistry module (see Supplementary Information for details), where the electrode reaction was modelled using the Butler-Volmer equation with the exchange current density following the mass action law . The rectangular channel, cavity and electrode geometries were described in 3D coordinates and the change in concentration of the oxidized form of the redox probe during the experiment was monitored as the average at the bottom of the cavity. The Taylor dispersion in the injection loop was simulated in a 2D cylindrically symmetrical model with a 10 cm connection tube after the loop. The output concentration from the connection tube was used as input into the microchannel. The angle of the cavity in the flow channel was varied to see the effect on the response time. To investigate the response of the cavity to EC reaction in the channel, we simulated the oxidation of a generic redox probe at an 8 mm wide electrode 1 mm upstream from the fiber. As in the previous case, the concentration of the oxidized form at the bottom of the cavity was monitored as a proxy for the optical response. The EC reaction was simulated chronoamperometrically as a potential step to large overpotential and a reverse step after 15 s. The simulation was performed for flowrates from 2 to 25 µl min -1 for the electrochemical system and 25-250 µl min -1 for the flow injection system.