Generate Google Map Api Key | Android | iOS | Integrate in Flutter & React Native

Created At: 2022-01-11 00:16:47 Updated At: 2022-01-12 01:13:00

You will learn how to generate API keys for google map in flutter. You will how to create a new project in and generate keys for iOS and android Apps. Then you will learn how to use the API Keys for the app and show the map in flutter app.

Before we go ahead we need to go there and register our app

Adding Google Maps to Flutter app (Android)

First, open your Flutter project and navigate to the file at this location: android/app/src/main/AndroidManifest.xml. We need to add the API key here. what we got from google cloud service.

<application ...
    <meta-data android:name=""
               android:value="YOUR KEY HERE"/>

After adding this now manifest file looks like this

<manifest xmlns:android=""

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />


       <!-- TODO: Add your API key here -->
       <meta-data android:name=""
           android:value="YOUR KEY HERE"/>


Remember though, that package name is quite important. otherwise you will not see any maps. You will see blank screen.

Android user should make sure that, in your android/app/build.gradle file minSdkVersion is 20

    defaultConfig {
        // TODO: Specify your own unique Application ID (
        applicationId "com.bslmeiyu.new_test"
        minSdkVersion 20
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

Adding Google Maps to Flutter (iOS)

You can open your flutter project either in androd studio or vs code. After that you need to go to ios/Runner folder. and then find AppDelegate.swift file and add the below code there.

import UIKit
import Flutter
import GoogleMaps
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)

Here you need to change the key. Put your API key for ios here. You got that code from the google cloud service console.

And then open info.plist file and add the key and string below

    <string>The app needs location permission</string>


And then put the code in your main.dart file

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  late GoogleMapController mapController;

  final LatLng _center = const LatLng(45.521563, -122.677433);

  void _onMapCreated(GoogleMapController controller) {
    mapController = controller;

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Maps Sample App'),
        body: GoogleMap(
          onMapCreated: _onMapCreated,
          initialCameraPosition: CameraPosition(
            target: _center,
            zoom: 11.0,


Add Reviews