google_map_location_picker 0.0.2 google_map_location_picker: ^0.0.2 copied to clipboard
🌍 Map location picker component for flutter Based on google_maps_flutter
google_map_location_picker #
Location picker using the official google_maps_flutter.
I made This plugin because google deprecated Place Picker.
Getting Started #
Get an API key at https://cloud.google.com/maps-platform/.
Android #
Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml
:
<manifest ...
<application ...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="YOUR KEY HERE"/>
iOS #
Specify your API key in the application delegate ios/Runner/AppDelegate.m
:
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GMSServices provideAPIKey:@"YOUR KEY HERE"];
[GeneratedPluginRegistrant registerWithRegistry:self];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
Or in your swift code, specify your API key in the application delegate ios/Runner/AppDelegate.swift
:
import UIKit
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("YOUR KEY HERE")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
Opt-in to the embedded views preview by adding a boolean property to the app's Info.plist
file
with the key io.flutter.embedded_views_preview
and the value YES
.
Using #
import 'package:google_map_location_picker/google_map_location_picker.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
LatLng result = await LocationPicker.pickLocation(context);
Note #
The package adds these permissions to android app, you don't need to do anything.
android.permission.INTERNET
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_NETWORK_STATE