Flutter-geolocator: distanceBetween function doesn't show in geolocator 6.0.0+1

Created on 31 Aug 2020  ·  5Comments  ·  Source: Baseflow/flutter-geolocator

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:

  • [x] :iphone: iOS
  • [x] :robot: Android
android ios bug up for graps

Most helpful comment

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

long1eu picture long1eu  ·  4Comments

lqmminh picture lqmminh  ·  6Comments

jaumard picture jaumard  ·  3Comments

devalp-pro picture devalp-pro  ·  3Comments

joesnarky picture joesnarky  ·  3Comments