What is the best way to train / practice back flips?
I want to learn how to do a back flip or a front flip but I don't want to do it on grass or something like that.
the reason behind it is to learn some kicks.
Enroll in an adult gymnastics class. While you can ask them to start with the back and front flips, they'll usually have you start with more basic things and will allow you to make gradual progress towards your flips over time. And they'll teach you good form with an emphasis on safety.
Safety is key, and so is being able to teach it to different people. In my experience, teachers who trained in Gymnastics generally have a better understanding of the fundamentals and of form. They also have more students, and so they're more experienced at teaching it to a larger variety of people.
That's not to say that you shouldn't learn from a Parkour instructor, a "tricking" club, or a Contemporary Wushu coach. Many of those people have gone out to learn gymnastics on their own, and they bring their gymnastics knowledge with them.
My wife who did adult gymnastics to help with her Contempory Wushu training mentioned to me just now that it's not so much that Parkour or Tricking gives you "bad form", it's that gymnastics form is done to look like proper gymnastics. It looks good for gymnastics, in other words. Whereas Parkour and Tricking coaches can often do it a different way and look different, but the effect is the same. It's not necessarily "bad".
I was going to recommend using a foam pit in an "open gym", but she corrected me. She said if you use the foam pit for this purpose, you will be training the wrong motion. A flip - whether it's a front or a back flip - should not be done for distance. When you flip, you should come down right where you started. A foam pit will require you to push outwards to launch yourself into the pit, and so it will train the wrong motion.
There are special harnesses that some gymnastics gyms have. They hang from the ceiling, and they attach to your waist. They let you do a flip without worrying as much about falling on your head. You still need a spotter, though.
The way I learned the front flip was the "wrong way", but it worked for me. I found a sturdy fence that came up to about chest height on me. Then I just ran towards it, placed my hands down on the top bar, and launched myself over it head first while pushing off of the bar. I tucked my chin and allowed the somersault motion to happen. I repeated this until I felt successful at it. And then I tried loosening my push on the top bar. I did this until I was about to jump over the top bar without touching it at all. And lastly, I did it to the air, without any bar. I just imagined that the bar was there. And it worked!
Technically, what I described is not a proper front flip. It's a diving front flip. But later on, I stopped running into it. I would jog into it. Then I would walk into it. Then I was perfectly still when I did it. And lastly, I tried to land exactly where I started. And it worked!
What I described is a method known as "successive approximation". This works for a lot of people, providing a short-cut approach for learning the fundamental concepts and committing them to muscle memory. But this is not the way you'll learn it in gymnastics. Gymnastics classes typically try to teach the "right" way to do it from the very beginning, in a very straight-forward manner.
What I described is not the safest way to learn it, either, because it's very easy to slip by accident and launch your face, teeth first, into the bar. That actually happened to me once. So be careful!
My best advice is to learn it the right way and practice it consistently, at least 3 days a week. Find a qualified gymnastics coach at a gym that has good ratings and which considers safety its first priority. Oh, and don't be in a rush to get it on your first day. It takes time. Learn to do it right. Only when you've reached a mental block and have tried it the "right" way should you try other approaches, in my opinion. But don't give up right away. If you're having a problem, talk it through with your coach.
Hope that helps.
The easiest solution would be to find an adult-friendly gymnastics, parkour, street dancing, or cheerleading class. They should already have the curriculum and equipment to teach you to safely perform forward and back flips.
Alternately, there are many instructional resources on the internet.
Google + Parkour Backflip Tutorial =
How To BACK FLIP - Free Running Tutorial: https://youtu.be/SJUqEy0mpSo
How To Parkour: Backflip Tutorial: https://youtu.be/1Lt843scNsc
HOW TO DO A BACKFLIP: https://youtu.be/c2f-glrrua0
To train yourself you will need a matted (or other soft-ish surface to fall on), and a spotter to keep you from breaking your neck (and point out what you are doing wrong).