Jefferson Geerman
ย ยทย CEO of D-liva

whats the best way to calculate price based on distance for an app similar to doordash.

Custom Code

I need to calculate a delivery price based on location within 5km the price is 10 and each KM after that is 50 cents, so far ive tride the following:

and it kind of works sometimes. im not sure if its the devices im testing it on. i turned on precise location for my PC and the iphone im testing on it aswel. and when i test it using the code testing function it works perfectly. but it doesnt work in practice. it uses the distance of a store (document reference for location in a collection) and global properties device location for the users Lat lang.

is there a better way of doing this or fox it?

What have you tried so far?

ive tried making sure the locations are set right using the exact latlang of places and seeing the distance in km and see if the price changes. making sure the device have precise location on.

Did you check FlutterFlow's Documentation for this topic?
No
1
8 replies