rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
287 stars 321 forks source link

imports 'file_manager.dart', 'location_callback_handler.dart', 'location_service_repository.dart' - what do they do? #321

Open ReaperTech opened 2 years ago

ReaperTech commented 2 years ago

Hello, can someone kindly advise me about the imports 'file_manager.dart', 'location_callback_handler.dart', 'location_service_repository.dart' - what do they do? They are imported in the example on this page: [https://github.com/rekabhq/background_locator/blob/master/example/lib/main.dart] . I understand that the location_callback_handler.dart will probably execute code when a location is received. What do the other two import files look like? Help greatly appreciated.

Yukams commented 2 years ago

Hi @ReaperTech,

file_manager.dart is used as a logging tool location_callback_handler.dart is using location_service_repository.dart's functions but wrapping them in a static function as it is required to give BackgroundLocator.registerLocationUpdate static functions as callbacks. location_service_repository.dart is where all the logic and the code is happening :)

Though it's not mandatory to use a file like location_callback_handler.dart, I personnaly used location_service_repository.dart directly by making its functions static, no idea if it's a bad coding habit but if it's easier for you, you can try it out.