getCurrentLocationAndSetState method

Future<void> getCurrentLocationAndSetState(
  1. dynamic setStateFunction(
    1. Position
    )
)

Implementation

Future<void> getCurrentLocationAndSetState(
    Function(Position) setStateFunction) async {
  try {
    Position position = await getCurrentLocation();
    setStateFunction(position);
  } catch (e) {
    print("Error getting location: $e");
  }
}