Nowhere-zero 3-flows in Cayley graphs on generalized dihedral group and generalized quaternion group