Around 30 µL of 1 M HCl solution was added to maintain pH 2 and stirred at room temperature for two hours. The solution was filtered with a 0.2 μm syringe filter before use. The phosphatebuffered saline solution (10 mM phosphate buffer, 2.7 mM KCl and 137 mM NaCl, pH 7.4) was introduced as sheath flow into Inlets 1 and 4 (Figure ). Both NaOH and HCl solutions were connected to Inlet 2 via a switching valve. The chitosan solution flowed on-chip via a connection to Inlet 3. Initially, HCl and chitosan solutions flowed on-chip (QHCl=1.0 mL h -1 , Qchitosan=0.8 mL h -1 ) and were surrounded by a sheath flow of PBS solution (both buffer flow rates had QPBS=30 mL h -1 in each inlet) using separate syringe pumps (PhD 2000, Harvard Apparatus, MA). A calming period of 10 minutes was implemented to allow the laminar co-flow between all 4 streams to become steady with electrodes being contacted by only the PBS buffer (Supporting Information, Figure ). Before switching Inlet 2 to NaOH, we ensured that the sheath flow completely covered the electrodes, preventing their contact by membrane reagent streams during synthesis. Then HCl solution was changed to NaOH solution by a switching valve, while maintaining the same flow rate (QNaOH=1.0 mL h -1 ). After approximately 25 mins, the chitosan membrane was fully formed, reaching its final thickness of 20 to 50 μm. Then, pumping was stopped for NaOH and chitosan solutions through Inlets 2 and 3, while the PBS buffer continued to flow through Inlets 1 and 4. The PBS washed out any unreacted precursor molecules from the channel, membrane, and any other surfaces of the microfluidic channel. The selected flow rates enabled the electrodes to be contacted by only PBS during the entire synthesis process.