Catalyzes the oxidative demethylation of N,N-dimethylglycine to yield sarcosine, formaldehyde and hydrogen peroxide. The oxidation of dimethylglycine is coupled to the synthesis of 5,10-methylenetetrahydrofolate through an unusual substrate channeling mechanism. This channeling occurs by nonbiased diffusion of the iminium intermediate through a large solvent cavity connecting active site 1 (N-terminus) and active site 2 (C-terminus). The synthesis of 5,10-methylenetetrahydrofolate (at active site 2) prevents the accumulation of formaldehyde, formed by hydrolysis of the iminium intermediate product (at active site 1). Does not oxidize sarcosine. H2O + N,N-dimethylglycine + O2 = formaldehyde + H2O2 + sarcosine (6S)-5,6,7,8-tetrahydrofolate + N,N-dimethylglycine + O2 = (6R)-5,10-methylene-5,6,7,8-tetrahydrofolate + H2O2 + sarcosine Binds 1 FAD per subunit. Optimum pH is 8.0-10.0. Belongs to the GcvT family.