.
final geoLocatorService = GeolocatorService();
final placesService = PlacesService();
final markerService = MarkerService();
//Variables
Position currentLocation;
List<PlaceSearch> searchResults;
StreamController<Place> selectedLocation = StreamController<Place>();
StreamController<LatLngBounds> bounds = StreamController<LatLngBounds>();
Place selectedLocationStatic;
String placeType;
List<Place> placeResults;
List<Marker> markers = List<Marker>();
ApplicationBloc() {
setCurrentLocation();
}
setCurrentLocation() async {
currentLocation = await geoLocatorService.getCurrentLocation();
selectedLocationStatic = Place(
name: null,
geometry: Geometry(
location: Location(
lat: currentLocation.latitude, lng: currentLocation.longitude),
),
);
notifyListeners();
}
searchPlaces(String searchTerm) async {
searchResults = await placesService.getAutocomplete(searchTerm);
notifyListeners();
}
setSelectedLocation(String placeId) async {
var sLocation = await placesService.getPlace(placeId);
selectedLocation.add(sLocation);
selectedLocationStatic = sLocation;
searchResults = null;
notifyListeners();
}