activateLocation method

Future activateLocation()

Activate the location if the location is not enabled or the permission is not granted ask the user to enable the location and grant the permission

Implementation

Future<dynamic> activateLocation() async {

  bool serviceEnabled = await location.serviceEnabled();

  if (!serviceEnabled) return await location.requestService();

  PermissionStatus permission = await location.hasPermission();

  if (permission == PermissionStatus.denied) return await location.requestPermission();
}