OH isn't this fun??? Hee hee. I swear everyone warned me with girls that four was like this transformation in personality! :) I went through this same thing, it is like terrible twos at four isn't it?
First sit her down when she is calm, ask her how her day is, what did she do, who did she play with? I can say really involving myself in my child's day I could tell if something had transpired during the day maybe to cause upset. I know too they are adjusting from being a toddler to a big kid and that is overwhelming.
All I can say is have a consequence for her telling you no, flipping out or whatever. You know what matters to her and if you go after that thing/priviledge and be hard core on not tolerating it and being consistent it will get better. They show you this side because she knows you will give her unconditional love, it is very common for kids to act their worst for those they are closest too. It is her safety zone, however you do not have to tolerate it either.
My ex moved away when we were going through this age so I felt so guilty and bad for my daughter I tolerated WAY more then I should have. In counselling I learned very fast that is where I failed, I failed tolerating it. I finally laid down the law, gave her very clear instructions on what was acceptable, not acceptable and her consequences. Early bed time for every sass starting at 10 minute intervals. There were a few nights she was in bed at 4pm! NO JOKE!
However she figured out after two or three weeks this is not what she wanted for herself. I let her know SHE CHOSE for her day to go like this and if she cannot do what is asked of her without issue then guess what, she did it to herself. I was very calm, matter of fact saying things like "well I am REALLY sorry you chose this for yourself, you now have 20 minutes off of bedtime, please think about that"...then if she pitched a fit, I would say "well there is another 10 minutes"...we did a chart so she knew each night where she stood. The day she got her regular bedtime due to a good day, WOW she was so proud of herself.
I praised the good behavior, I let her know I didn't expect her to be perfect and it was okay to be angry, sad or irratated however it was how she acted with those feelings that got her in trouble. I would reassure her I love her very much and it is my job to teach her how to be a great grown up, that there are rules and she needed to abide by them. I explained how sad it made me when she got into trouble too. Being empathetic, listening and letting her know why she is in trouble helped my daughte a lot.
It wasn't fun, each child has something that matters enough to use as a negotiating tool. For my daughter it was bedtime. My son worked well with earning smiley faces.
The worst was over close to 5, she is really a great kid, just very passionate about her feelings and very hard headed sometimes. I am learning that she has some of me in her and I am her example of how to react when stressed. She has taught me a lot and together we may make it into teenhood!! HOPING!!! :)
I also implemented NO MATTER where we are there is a cooling off/time out spot. I learned never make a threat you weren't willing to follow through with!! That was huge for me! I didn't care who saw her meltdown, I just set her in a corner wherever we were.