onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() async {
super.onInit();
AppConfig.logger.t("Maps Controller Init");
profile = userServiceImpl.profile;
if(profile.position != null) {
location = Location(lat: profile.position!.latitude, lng: profile.position!.longitude);
} else {
try {
Position position = await Geolocator.getCurrentPosition(
locationSettings: LocationSettings(accuracy: LocationAccuracy.high,)
);
profile.position = position;
userServiceImpl.profile = profile;
} catch (e) {
AppConfig.logger.e(e.toString());
}
}
await goToHomePosition();
}