So basically, I want to have a button where I can begin the tracking, and when I click the second time, the driven route should be displayed on the map and the driven distance (in kilometres) should be displayed.
I searched up the Internet but found no solution on that.
I would be happy if anyone could help me, thanks.
For as far as I'm concerned this can not be achieved via a Google Maps API.
Like Andy replied in a comment on your question, you can keep track of the coordinates from the Geolocator package (https://pub.dev/packages/geolocator) and compute the distance between each sequential point (Maps Toolkit provides these functions: https://pub.dev/packages/maps_toolkit). Add these up and you have an approximation of the distance. How more often you keep track of the location, how more accurate it will be.
Keep in mind: if you track based on time, the approximation may be less accurate due the (higher) speed of the device that's travelling. I'd suggest you adjust the interval of point-tracking based on the speed.