Hi, I can't find how to call the distanceBetween
function, even the readme example doesn't work in a sample proyect
I check the package files, and the problem is that geolocator.dart doesn't have any call to distanceBetween function of GeolocatorPlatformInterface
Version: 6.0.0+1
Platform:
Hi @hectorAguero, these are static methods defined in the GeolocatorPlatform
class and therefore can be accessed as follows:
final distance = GeolocatorPlatform.distanceBetween();
I will make sure I will update the documentation to reflect this.
Thank you i too faced the same issue.
@mvanbeusekom solution doesn't work in 6.0.0+2, now I need to call the instance, documentation isn't updated
final distance = GeolocatorPlatform.instance.distanceBetween();
I don't think this is the better aproach, because to call other geolocator functions only need to write the function name.
@hectorAguero you are completely right, I have released 6.0.0+2 a bit to quickly.
My intent was to make the distanceBetween
and bearingBetween
instance methods (which I did) and make global function overrides for them (so you can call them easily like all other methods, and also have support for overriding their implementation if needed). This last part I forgot to implement when I got a bit disturbed from other work coming through.
I will release a fix (and updated documentation) for this in a few minutes. So you can easily call them like this:
final distance = distanceBetween(56.9, 6.4, 54.3, 6.3);
Apologies for the inconvenience and thanks a lot for the feedback.
@hectorAguero, I have just released the latest version (6.0.0+3) where I implemented the changes above (b.t.w. you can still use the GeolocatorPlatform.instance.distanceBetween
method, but there is now also a shorthand method available using simply distanceBetween
.
I have added unit-test and updated the documentation to make sure there will not be any confusion anymore in the future. Thanks again for reporting the issue and providing the detailed feedback.
Most helpful comment
Hi @hectorAguero, these are static methods defined in the
GeolocatorPlatform
class and therefore can be accessed as follows:I will make sure I will update the documentation to reflect this.