Reputation: 305
It says Google Map is not installed or is disabled. Google Map is installed. So somehow disabled. How can i use it in my project? This image will show you what i meant:
Codes are here:
const double ZOOM = 1;
class HomeView extends StatelessWidget {
static GoogleMapController? _googleMapController;
Set<Marker> markers = Set();
// ignore: prefer_final_fields, unused_field
Completer<GoogleMapController> _controllerGoogleMap = Completer();
late GoogleMapController newGoogleMapController;
late Position currentPosition;
var geoLocator = Geolocator();
double bottomPaddingOfMap = 0;
void locatePosition() async {
//USER CURRENT LOCATION
Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
currentPosition = position;
LatLng latLatPosition = LatLng(position.latitude, position.longitude);
CameraPosition cameraPosition =
// ignore: unnecessary_new
new CameraPosition(target: latLatPosition, zoom: 14);
newGoogleMapController
.animateCamera(CameraUpdate.newCameraPosition(cameraPosition));
}
static const CameraPosition _kGooglePlex = const CameraPosition(
target: LatLng(40.7956, 29.4420),
zoom: 14.4746,
);
@override
Widget build(BuildContext context) {
return SafeArea(
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection("Location").snapshots(),
builder: (context, snapshot) {
// ignore: avoid_print
print(snapshot);
if (snapshot.hasData) {
//Extract the location from document
GeoPoint location = snapshot.data!.docs.first.get("location");
Upvotes: 2
Views: 535
Reputation: 62
I had the same problem and I think solved it by enabling the Maps SDK for android and Maps SDK for IOS in the GoogleMapsConsole -> APILibrary
section.
then reinstall the application and if you're using the emulator restart it as well.
Hope it could help you.
Upvotes: 0
Reputation: 1242
I'm assuming you use this package google_maps_flutter As with all the flutter packages that imply connecting to some google api (or else), there is some setup involved that is described on the package page.
It is really important to do all that's needed before the package can work, including getting an api key Google Cloud, activating Maps for Android and for iOS on it (if you need both). And then you have some setup to do for both iOS and Android on your flutter app.
It's all described in the link I provided, and you should follow their instructions rigorously. All it takes is one little setup error to stop the whole thing from working.
Upvotes: 0
Reputation: 39
If you hadn't use google map apis then create one api key on GCP. After creating one api, use that in FLutter project.
Upvotes: 0
Reputation: 131
You will need to add the Google Maps package "com.google.android.apps.maps" in AndroidManifest.xml
<manifest package="com.your.package">
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
...
</manifest>
Upvotes: 1