We design a substrate-free, inhomogeneous grating resonantly excited by magnetic dipoles. The proposed baseless metagrating is compared with the base grating metasurface and the uniform grating metasurface respectively. The advantages of our proposed non-uniform grating metasurface are illustrated. Further, we design a microfluidic sensor based on the structural properties of the proposed grating metasurface. The Fano resonance is excited by magnetic dipoles, the theoretical quality factor is as high as 114.86, and the theoretical sensitivity is as high as 189GHz/RIU. Experimentally, we completed high depth etching of the grating metasurface and packaged the grating metasurface into a microfluidic sensor. During detection, the liquid flows back and forth between the grating gaps, changing the dielectric distribution inside the grating metasurface, making its response more sensitive. Finally, we successfully detected and characterized BSA solutions with different concentrations, milk with different water ratios, absolute ethanol, and petroleum ether.