So I have a map view where I route to another view. In that map route I got a method:
void animateToUser() async {
final pos = await _location.getLocation();
_mapController?.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(
target: LatLng(pos.latitude!, pos.longitude!), zoom: 15)));
}
When Im on another view I use this to go back to the screen
onTap: () {
Navigator.of(context).pop();
})
However I would like to trigger this animateToUser
method just after the pop method. Is this achievable?
CodePudding user response:
you can pass this callback to your new screen. so you have access to call it before Navigator.of(context).pop();
.