The U.S. Supreme Court said this back in 1943, in the landmark case West Virginia State Board of Education v. Barnette. As Cornell Law School points out, the decision hinged on the idea that any state action making it compulsory for public school children to salute the flag and pledge allegiance violates the First and Fourteenth Amendments.
In his court opinion, Justice Robert Jackson offered this kernel of wisdom:
“If there is any fixed star in our constitutional constellation, it is that no official, high or petty, can prescribe what shall be orthodox in politics, nationalism, religion, or other matters of opinion or force citizens to confess by word or act their faith therein. If there are any circumstances which permit an exception, they do not now occur to us.”
https://en.m.wikipedia.org/wiki/West_Vi ... ._Barnette



