No flack that I remember. And no, it's not illegal not to say something or to sing.
I recall being in 2nd grade of a diverse public school (probably 99% free lunch) many moons ago and going to the auditorium to sing the anthem. No one knew the words, including the teachers. Pissed off the new principal. So in music class, for the rest of the year, instead of singing about a purple dinosaur, we learned and sang the national anthem. And then we all sang it at the spring concert. I think that is why I hate the national anthem, and I have not sung it since.
Period. Some might want to make it so, but it will not happen.
Do as you choose.
I ignored the pledge of allegiance and the national anthem as a kid. My mom was a Jehovah's Witness. Later, after my mom got kicked out of the Witnesses (because she couldn't stay out of politics), we were Quakers. My dad was more comfortable with them.
My mom's family was largely pacifist, which is how they ended up in the U.S. Wild West. They were escaping wars in Europe, and later the U.S. Civil War. My mom's dad refused arms in World War II, but his compromise was to build and repair ships for the Merchant Marine. He wouldn't touch warships.
The only time I felt embarrassed about skipping the pledge was when my fourth grade teacher used me as an impromptu civics lesson about religious freedom in the U.S.A.. She wasn't being mean at all, she was pointing it out as something to be proud of, but I was already a weird kid and her attention only added to my aura of weirdness. But whatever I suffered by ignoring the pledge was nothing compared to the religious persecution my ancestors faced.
I'd remove the pledge of allegiance from school, it's an empty thing, the kind of thing authoritarian nations do. The only tolerable thing about the pledge is that it's not mandatory.
The "Star Spangled Banner" is simply an abomination, both musically and as an anthem.