If the earth was flat, then there would have to be a fundamental change in the laws of our reality. As such, I wouldn't call it earth because it would be nothing like our planet. However if you're asking how a flat planet would work, then I will explain how I would see it happen in a universe with an energy type that the sapient races call magic, although it isn't quite the same.
In this universe there is another energy type that was formed in the big bang. Instead of just having positive and negative energy/matter, there is also a neutral energy that was formed by the successful merger of positive and negative states. Being something new, and yet still partially both previous states, it is able to to affect both states while remaining separate. However, it is not plentiful enough to form planets of its own. Because of this it is mixed in with the creations of the other types.
One such type is that of the flat planet. This is a mix of mostly positive and partially neutral types that occurs after the positive type creates a solar system. The remnant energy left from this system settling in pulled the neutral type in to the system. Some of the neutral type settled on the planet third from the sun and shifted it into a dimensional anomaly. The species that eventually evolved on this planet didn't know of the unique situation there planet was in but from the outside the planet looks like it is a rapidly shifting 2d pictured a planet that is slowly rotating. However from the inside the sky only lights up from one line, the light shifting as the planet rotates.