Skip to main content

Flutter App’s Link to Google Map

                                                   
                        Flutter App’s Link to Google Map 

    Note: I suggest you run a flutter upgrade prior making below amendments  

1) Log in to Google Cloud Platform and create a project for the API Key. Follow the instructions and basic settings.  
PS: Billing account won't charge you a penny, Also API key is per project, Save “Your API Key” on a notepad 

2) Now go to DartPack  https://pub.dev/flutter/packages 
     Search for google maps flutter 




3) Add the dependencies of packages  pubspec.yaml file to: 
   google_maps_flutter ^0.5.27+1 (PS: Version will vary according to the time) 
And click Packages Get 
       

For Android 
1)  Add the API key to Manifest: 
Go to android/app/src/main/AndroidManifest.xml: 







Paste the settings as shown below, REMEMBER TO USE YOUR KEY 

 <meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR KEY HERE"/>

That’s it done for Android! 

For IOS: 
1) Specify your API key in the application delegate ios/Runner/AppDelegate.swift 


Copy and replace with the below code, REMEMBER TO ADD YOUR KEY. 

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}





2) adding a boolean property to the app's Info.plist 
Go to Info.plist 

          Paste the below code   as shown in the screenshot  
            <key>io.flutter.embedded_views_preview</key>             <true/> 

                Done! 

Comments

Popular posts from this blog

Adding a splash screen on Android flutter app

Adding a splash screen on Android flutter app am using 1024 * 1024 dimension image, also remember don't use file names with symbols but underscore "_" Copy and paste the image on to all the mipmap folder under android                                    Next go to drawable and open launch_background.xml and uncomment image assets info  Update with splash image name and source,  see below:     Rerun the Build, close reopen app to see the splash screen !! I like to use my own style/color ( this is optional ). Go to the values folder and create an xml file , I call it colors.xml ( New file > filename.xml ) add the xml properties on newly created file, in our case colors.xml                 <?xml version="1.0" encoding="utf-8" ?>  and the style and color of your choice. ...

Cannot fit requested classes in a single dex file

            Error: Cannot fit requested classes in a single dex file  Scenario:  Building project with cloud_firestore  Error: Fix: Go to app level build.gradle  and append minSdkVersion from 16 to 21, see below: now rerun the build!