Giter VIP home page Giter VIP logo

google_maps_webservice's Introduction

Build Status codecov Star on Github Buy Me A Coffee

google_maps_webservice

General Information

This is the Dart Library for Google Maps Webservices. You can find the Google Maps Platform Documentation here, but if you're new to this, you may want to start here.

API Key

To use this library you need a Web API key. Follow these steps to acquire the key relevant to your particular Dart application.

These keys are not to be used individually as Android or iOS API keys, but they are instead meant to be used in your Dart application.

Availables API

Usage

Geocoding

import "package:google_maps_webservice/geocoding.dart";

final geocoding = GoogleMapsGeocoding(apiKey: "<API_KEY>");
final geocoding = GoogleMapsGeocoding(apiKey: "<API_KEY>", httpClient: BrowserClient());
final geocoding = GoogleMapsGeocoding(baseUrl: "http://myProxy.com");

GeocodingResponse response = await geocoding.searchByAddress("1600 Amphitheatre Parkway, Mountain View, CA");

Places

import "package:google_maps_webservice/places.dart";

final places = GoogleMapsPlaces(apiKey: "<API_KEY>");
final places = GoogleMapsPlaces(apiKey: "<API_KEY>", httpClient: BrowserClient());
final places = GoogleMapsPlaces(baseUrl: "http://myProxy.com");

PlacesSearchResponse response = await places.searchNearbyWithRadius(Location(lat: 31.0424, lng: 42.421), 500);
PlacesSearchResponse response = await places.searchNearbyWithRankby(Location(lat: 31.0424, lng: 42.421), "distance");
PlacesSearchResponse response = await places.searchByText("123 Main Street");

PlacesDetailsResponse response = await places.getDetailsByPlaceId("PLACE_ID");
PlacesDetailsResponse response = await places.getDetailsByReference("REF");

Timezone

import "package:google_maps_webservice/timezone.dart";

final timezone = GoogleMapsTimezone(apiKey: "<API_KEY>");
final timezone = GoogleMapsTimezone(apiKey: "<API_KEY>", httpClient: BrowserClient());
final timezone = GoogleMapsTimezone(baseUrl: "http://myProxy.com");

TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421));
TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421), timestamp: DateTime.utc(2019, 4, 24));
TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421), timestamp: DateTime.utc(2019, 4, 24), language: 'es');

Static Map

  StaticMap mapStatic = StaticMap(
    apiKey,
    markers: List.from([
      Location(lat: 23.721160, lng: 90.394435),
      Location(lat: 23.732322, lng: 90.385142),]
    ),
    path: Path(
      enc: 'svh~F`j}uOusC`bD',
      color: 'black',
    ),
    scale: 'false'
  )

  String url = mapStatic.getUrl();

  Image.network(url)

Proxy

In case of using a proxy the baseUrl can be set. The apiKey is not required in case the proxy sets it. (Not storing the apiKey in the app is good practice)

Feature Requests and Issues

Please file feature requests and bugs at the issue tracker.

google_maps_webservice's People

Contributors

1abid avatar ahmedny avatar aryzhov avatar austinrappa78 avatar bcko avatar breitembach avatar brex900 avatar cdfq152313 avatar domesticmouse avatar erf avatar hallerpatrick avatar jmolins avatar jonjon1123 avatar krispypen avatar lejard-h avatar mattpannella avatar mbilalakmal avatar owersbrett avatar piopon avatar pratikpparikh avatar puduru avatar safarmer avatar sdolski avatar tockn avatar tshedor avatar wagner1343 avatar zeshuaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google_maps_webservice's Issues

Unable to load asset: packages/flutter_google_places/assets/google_white.png

RaisedButton(
                        child: Text(
                          "location"
                        ),
                        onPressed:  () async {
                            Prediction prediction = await PlacesAutocomplete.show(
                            context: context,
                            apiKey: "AIzaSyDSOCqUpchX-xIleHNHQwKZS_Jda64fzxg",
                            mode:  Mode.overlay, // Mode.overlay
                            language: "en",
                            components: [Component(Component.country, "us")]);
                        },
                      ),

When I click the button, my ios simulator hangs and after I reload the simulator, it shows the error below. Please advise thanks!

════════ Exception caught by image resource service ════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: packages/flutter_google_places/assets/google_white.png

When the exception was thrown, this was the stack
#0 PlatformAssetBundle.load
package:flutter/…/services/asset_bundle.dart:221

#1 AssetBundleImageProvider._loadAsync
package:flutter/…/painting/image_provider.dart:664
#2 AssetBundleImageProvider.load
package:flutter/…/painting/image_provider.dart:648
#3 ImageProvider.resolveStreamForKey.
package:flutter/…/painting/image_provider.dart:501
...
Image provider: ExactAssetImage(name: "packages/flutter_google_places/assets/google_white.png", scale: 2.5, bundle: null)

No 'Access-Control-Allow-Origin' header is present on the requested resource

Hello, i am getting this error when i send a request to maps/api/place.
I am developing for web. Thanks

Error: Access to fetch at 'https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ70taCKKAhYAR5IMmYwQT4Ts&key={APIKEY}' from origin has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

// dependencies
dependencies:
flutter:
sdk: flutter
provider: ^3.1.0
cupertino_icons: ^0.1.3
cloud_firestore: ^0.13.4+2
google_maps_flutter: ^0.5.25+3
google_maps_webservice: ^0.0.16
location: ^2.3.5

Result parsing throws error when 'opening_hours' is array

Result parsing throws error when 'opening_hours' is array:

Exception: type 'List<dynamic>' is not a subtype of type 'Map<dynamic, dynamic>'
#0 new PlacesSearchResult.fromJson (package:google_maps_webservice/src/places.dart:468:43)
#1 new PlacesSearchResponse.fromJson.<anonymous closure> (package:google_maps_webservice/src/places.dart:396:47)
#2 MappedListIterable.elementAt (dart:_internal/iterable.dart:417:31)
#3 ListIterable.toList (dart:_internal/iterable.dart:221:19)
#4 new PlacesSearchResponse.fromJson (package:google_maps_webservice/src/places.dart:397:17)
....

Response from Google Places:

{
  "formatted_address": "〒242-0008 神奈川県大和市**林間西6丁目8−26",
  "geometry": {
    "location": {
      "lat": 35.503321100000001,
      "lng": 139.43355740000001
    },
    "viewport": {
      "northeast": {
        "lat": 35.50458807989272,
        "lng": 139.4349431298927
      },
      "southwest": {
        "lat": 35.501888420107278,
        "lng": 139.43224347010721
      }
    }
  },
  "icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
  "id": "5170481a0aa6ddb27a0af75dffa6d5c045b8bca1",
  "name": "リバークレイン横浜フルフィルメントセンター",
  "opening_hours": [
    
  ],
  "photos": [
    {
      "height": 5333,
      "html_attributions": [
        "<a href=\"https://maps.google.com/maps/contrib/112572136717579507791\">砂川希</a>"
      ],
      "photo_reference": "CmRaAAAA22OeAvkly67fQxge7vmnLX2h4Igylz3hqXYo38ismp4zLSy6wRl-sdc9_q0UqcG0idGRtSnNo6YSyATYz6tZhgITRaL_df0_Mkm1Z28N1cuJG-NrDs2lBZ1OX2j-YJrOEhAZvB9qLSuK43zeHjqgrUo9GhQS4PomUFuBKeNnC1a99cyjz34bHg",
      "width": 3000
    }
  ],
  "place_id": "ChIJwaUIrjv_GGARWsQI7vckwgQ",
  "plus_code": {
    "compound_code": "GC3M+8C 大和市、神奈川県",
    "global_code": "8Q7XGC3M+8C"
  },
  "rating": 2.1000000000000001,
  "reference": "ChIJwaUIrjv_GGARWsQI7vckwgQ",
  "types": [
    "point_of_interest",
    "establishment"
  ],
  "user_ratings_total": 15
}

"partial_match" has been changed from String to bool

Please fix this minor issue. "partial_match" has been changed from String to bool in the model of GeocodedWaypoint, which can make deserialization failed in direction API.

Please let us know if this repo is still in maintenance or not.

Distance Matrix Importing syntax error

Good Day.

Whenever I try to import "package:google_maps_webservice/distance.dart"; I always get a syntax error. Its possible that the code has some missing brackets somewhere.

Thank you.

How I can consume Google map web services API in my flutter APP

I am new in Flutter, and I have pretty good knowledge of using Google maps APIs for native Android Apps. However, in my flutter app I need Google Places search Auto-complete. I came across to this plugin
it consumes google maps APIs such as directions, places and geocoding using Google web services. My question is having low understanding and experiences in setting up web services for google maps API, how I can use plugin in my flutter app? For example, if I had to use places API in android I would have enabled Goole Places SDK in cloud console and generate an API restricting for Android App. But for flutter both Android and iOS is going to use same services from web API call. what should I do? And right now I have no backend knowledge to set up a domain to use while creating the API from console.

Map Styles

Will this API display my google web_map API and allow me to use a custom map styles (JSON) unlike the current (google maps flutter plugin)?

Getting polylines to pass GoogleMap() widget

Hello. I've been searching over the internet including your API references and documentation, but I can't find any resource of full usage of your package. I want to use google_maps_webservice/directions to implement in-app navigation, but I can't find a way to do it. Can you please help me to achieve that? Any help would be much appreciated. Thanks

Directions Step missing 'maneuver' property

As a dev I would like to use the maneuver field in steps.

Each step within the steps field(s) may contain the following fields:
maneuver contains the action to take for the current step (turn left, merge, straight, etc.). This field is used to determine which icon to display, and can contain one of the following values: turn-slight-left, turn-sharp-left, uturn-left, turn-left, turn-slight-right, turn-sharp-right, uturn-right, turn-right, straight, ramp-left, ramp-right, merge, fork-left, fork-right, ferry, ferry-train, roundabout-left, roundabout-right. Values in this list are subject to change.

Directions API

NearbySearch with SKU

Any chances to have also the possibility to filter by SKU?

from the docs

You make a Nearby Search request, for example: NearbySearch(San Francisco, 100 meters). On your bill, you will see the following SKUs listed (when viewing your bill by SKU):

Places - Nearby Search (price starting at 0.032 USD per call)
Basic Data (billed at 0.00 USD)
Contact Data (price starting at 0.003 USD per request)
Atmosphere Data (price starting at 0.005 USD per request)

(and maybe also with the session)

Otherwise it's expensive if I only need the basic,
Thank you :)

Getting user_ratings_total

Hi,
Is it possible to retrieve the user_ratings_total field from the place details request using your package?
Thank you!

How do I know which SKUs are being used?

In my app, I would like to search for a place through a search bar with autocomplete. I would only like to search by the name of the place or address. I would then like to get the coordinates of the found place through the geocoding api.

I would like to do all of that with minimal costs and as I do not need any detailed information about the places (opening hours, reviews, photos and etc), I would like to know how to "turn them off" or find whether they are being used.

How to Search for Addresses using Postal Codes

I am trying to get a list of addresses using postal codes.

This is a snippet of code:

import 'package:google_maps_webservice/places.dart';

final _places = GoogleMapsPlaces(apiKey: '<API-Key>');

void main() async {
  // This is a valid British postal code.
  final postalCode = 'WC2N 5DU';

  final response = await _places.autocomplete(
    postalCode,
    components: [
      Component(Component.postalCode, postalCode),
      Component(Component.country, 'UK'),
    ],
  );

  if (response.isOkay) {
    for (Prediction prediction in response.predictions) {
      print(prediction.description);
    }
  } else {
    print(response.status);
  }
}

I am getting an INVALID_REQUEST status.

Returning only 1 result

All requests I do by text returns me only one result. Is it a intentional behavior or there is something worng with the api?

I am am currently on this version: google_maps_webservice: ^0.0.12

My code:
image

Prints:
image

List<dynamic>' is not a subtype of type 'PlaceDetails'

getDetailsByPlacedId is throwing an exception: "Exception has occurred.
_TypeError (type 'List' is not a subtype of type 'PlaceDetails')" Stack trace shows it is on PlaceDetails.fromJson in this section of places.dart:

  factory PlacesDetailsResponse.fromJson(Map json) => json != null
      ? PlacesDetailsResponse(
          json['status'],
          json['error_message'],
          json['result'] != null ? PlaceDetails.fromJson(json['result']) : [],
          json['html_attributions'] != null
              ? (json['html_attributions'] as List)?.cast<String>()
              : [])
      : null;

distance response REQUEST_DENIED

I am using right api_key as shown in the example: final GoogleDistanceMatrix distanceMatrix = GoogleDistanceMatrix( apiKey: Platform.environment["my_api"]); but getting error request denied

How to add and manage session tokens in flutter project

Hello,
Thanks for sharing such a useful package for integrating various Google APIs under one roof.

I am glad using it. But I am facing issues with pricing because in Google Autocomplete requests, there are a lot of queries generated without maintaining session tokens.

The APIs I use :

  1. Google Autocomplete API (multiple times)
  2. Google Place Details (single time as per user selected location)
  3. Google Geocoding (single time as per user inputs any location))

Please guide how to handle session tokens in flutter app to reduce pricing from Google Maps !

type '_InternalLinkedHashMap' is not a subtype of type 'Map'

I believe the changes in b29673b are causing the following error:

type '_InternalLinkedHashMap' is not a subtype of type 'Map'

Code Sample:

location.geometry.toJson()

Looks like the issue is here:

Map<String, dynamic> toJson() {
var map = {};
map['lat'] = lat;
map['lng'] = lng;
return map;
}

Looks like the following is causing map to be inferred as an _internalLinkedHashMap<dynamic,dynamic> as opposed to an _internalLinkedHashMap<String,dynamic>

var map = {};

I believe the following should fix it:

Map<String, dynamic> toJson() => {
    'lat': lat.
    'lng': lng,
}

alternatives flag not correctly passed on in the directions(...) API

The alternatives flag directs the google maps API to provide alternative routes. Although a corresponding parameter exists in the APIs

  • directionsWithAddress
  • directionsWithLocation
  • directions

this parametr is never used by the named methods and not passed on to the buildUrl(...) method, so one will always get a single route result.

Obtain image automaticaly

Hello,
When we do a getDetailsByPlaceId, it would be usefull to have a parameter named "photos" to tell the plugin that we want to load some photos of the spot without using the buildPhotoUrl, so have a Image variable in the Photo class.

It would be also usefull to have a getNextPicture to load the next picture.

Does Not appear in a PWA

We haven't looked into it to much but the Google Maps don't appear to operate in our first blush at a PWA.

Any thoughts?

searchByAdress throws TypeError with partial match == true

Please have a look into the following issue:

type 'bool' is not a subtype of type 'String'

Breakpoint reached: Break on exceptions
Stack: 
	new GeocodingResult.fromJson (geocoding.dart:145)
	new GeocodingResponse.fromJson.<anonymous closure> (geocoding.dart:105)
	MappedListIterable.elementAt (iterable.dart:414)
	ListIterable.toList (iterable.dart:219)
	new GeocodingResponse.fromJson (geocoding.dart:107)
	GoogleMapsGeocoding._decode (geocoding.dart:91)
	GoogleMapsGeocoding.searchByAddress (geocoding.dart:27)
	<asynchronous gap>
	_PlaceCreationState._reloadMapImgFromAdress.<anonymous closure> (place_creation.dart:355)
	<asynchronous gap>
	_Closure.call (libfunction.dart:1)
	new Future.delayed.<anonymous closure> (future.dart:310)
	_Closure.call (libfunction.dart:1)
	Timer._createTimer.<anonymous closure> (libtimer_patch.dart:21)
	_Closure.call (libfunction.dart:1)
	_Timer._runTimers (libtimer_impl.dart:382)
	_Timer._handleMessage (libtimer_impl.dart:416)
	_Timer._handleMessage (libtimer_impl.dart:1)
	_Closure.call (libfunction.dart:1)
	_RawReceivePortImpl._handleMessage (libisolate_patch.dart:165)

related to place picker?

I found out that google's place picker is deprecated as written here:
Place Picker

Does this plugin have anything to do with it? Sorry if they are not related. Just had to make sure before using this awesome plugin:)

GeoLocation?

Can you make this plugin work with GeoLocation? My project needs to be worked with Current Location of user.
If not, can you give me some directions about this features? Thanks a lot.

App restriction

When APP Restriction is activated under google cloud platform, it stops working even with API restrictions disabled.

'Int' is not double

Please, add a checking in the file 'core.dart' line 9. If json handed over integer, exception is thrown
factory Location.fromJson(Map json) => json != null ? new Location(json["lat"], json["lng"]) : null;
Maybe, like here?

factory Location.fromJson(Map json) => json != null
      ? new Location(
          json["lat"].runtimeType == double
              ? json["lat"]
              : (json["lat"] as int).toDouble(),
          json["lng"])
      : null;

PlaceDetails.fromJson - check for missing response field

Defect, google api allows you to get place details with selective field as they charge based on the information you access. The fromJson method should do appropriate check for null and empty before assigning the value to object.

Get Street, address, city, state from Prediction object.

How to get street, address, city, state from Prediction object. There is a 'terms' list field that have the information but how to know where in the list that information is present.

For reference, in one of my javascript app, I am using google autocomplete and to get specific information I did the following:

let place:Place = new Place();
    googlePlace.address_components.forEach(a =>{
      if(a.types.indexOf("street_number") > -1){
        place.streetNumber = a.long_name;
      }else if(a.types.indexOf("route") > -1){
        place.address = a.long_name;
      }else if(a.types.indexOf("locality") > -1){
        place.city = a.long_name;
      }else if(a.types.indexOf("administrative_area_level_1") > -1){
        place.state = a.short_name;
      }else if(a.types.indexOf("postal_code") > -1){
        place.zip = a.short_name;
      } else if(a.types.indexOf("country") > -1){
        place.country = a.short_name;
      }
    });

alternatives parameter not work.

alternatives parameter not work.
the GoogleMapsDirections api always return one route result.
'alternatives' and 'waypoints' is mutually exclusive.

https://developers.google.com/maps/documentation/directions/intro#optional-parameters
alternatives — If set to true, specifies that the Directions service may provide more than one route alternative in the response. Note that providing route alternatives may increase the response time from the server. This is only available for requests without intermediate waypoints.

HandshakeException: Connection terminated during handshake

Hi, I'm using this package for autocomplete and it's working most of the time. But some users are reporting a HandshakeException. I don't have any ideas on how to reproduce it

The code:

final places = new GoogleMapsPlaces(apiKey: Global.instance.mapsKey)
locations = await places.autocomplete(
      text,
      types:  ['(regions)'],
      language: 'pt-br',
      components: [Component(Component.country, 'br')],
);

The Stack Trace (Using catcher):

#0 IOClient.send (package:http/src/io_client.dart:33)

#1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:169)

#2 BaseClient.get (package:http/src/base_client.dart:32)
#3 GoogleWebService.doGet (package:google_maps_webservice/src/utils.dart:53)
#4 GoogleMapsPlaces.autocomplete (package:google_maps_webservice/src/places.dart:156)

#5 _LocalsState.filterByName (package:falta1/components/localsFilter.dart:141)

#6 EditableTextState._formatAndSetValue (package:flutter/src/widgets/editable_text.dart:1003)
#7 EditableTextState.updateEditingValue (package:flutter/src/widgets/editable_text.dart:664)
#8 _TextInputClientHandler._handleTextInputInvocation (package:flutter/src/services/text_input.dart:728)

#9 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:383)

#10 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:351)
#11 BinaryMessages.handlePlatformMessage (package:flutter/src/services/platform_messages.dart:73)

#12 _invoke3. (dart:ui/hooks.dart:253)
#13 _rootRun (dart:async/zone.dart:1124)
#14 _CustomZone.run (dart:async/zone.dart:1021)
#15 _CustomZone.runGuarded (dart:async/zone.dart:923)
#16 _invoke3 (dart:ui/hooks.dart:252)
#17 _dispatchPlatformMessage (dart:ui/hooks.dart:126)

Flutter doctor:

[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale
    en_US.UTF-8)
    • Flutter version 1.7.8+hotfix.4 at /home/lucas/flutter
    • Framework revision 20e59316b8 (2 weeks ago), 2019-07-18
      20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0

 
[✓] Android toolchain - develop for Android devices (Android SDK 
    version 28.0.3)
    • Android SDK at /home/lucas/Android/Sdk
    • Android NDK location not configured (optional; useful for
      native profiling support)
    • Platform android-Q, build-tools 28.0.3
    • Java binary at:
      /home/lucas/.local/share/JetBrains/Toolbox/apps/AndroidStudio/c
      h-0/183.5692245/jre/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1343-b16-5323222)
    • All Android licenses accepted.

[✓] Android Studio (version 3.4)
    • Android Studio at
      /home/lucas/.local/share/JetBrains/Toolbox/apps/AndroidStudio/c
      h-0/183.5692245
    • Flutter plugin version 36.1.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1343-b16-5323222)

[✓] VS Code (version 1.36.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.2.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 •
      Android 8.1.0 (API 27) (emulator)

• No issues found!

Device Parameters (from catcher):

board: sdm660
bootloader: unknown
brand: xiaomi
device: lavender
display: PKQ1.180904.001
fingerprint: xiaomi/lavender/lavender:9/PKQ1.180904.001/V10.3.6.0.PFGMIXM:user/release-keys
hardware: qcom
host: mi-server
isPsychicalDevice: true
manufacturer: Xiaomi
model: Redmi Note 7
product: lavender
tags: release-keys
type: user
versionBaseOs:
versionCodename: REL
versionIncremental: V10.3.6.0.PFGMIXM
versionPreviewSdk: 0
versionRelase: 9
versionSdk: 28
versionSecurityPatch: 2019-05-05

token

library google_maps_webservice.places.autocomplete.example;

import 'dart:io';
import 'package:google_maps_webservice/places.dart';

final places = new GoogleMapsPlaces(apiKey: Platform.environment["API_KEY"]);

main() async {
String sessionToken = "xyzabc_1234";
PlacesAutocompleteResponse res =
await places.autocomplete("Amoeba", sessionToken: sessionToken);

if (res.isOkay) {
// list autocomplete prediction
res.predictions.forEach((Prediction p) {
print("- ${p.description}");
});

// get detail of the first result
PlacesDetailsResponse details = await places.getDetailsByPlaceId(
    res.predictions.first.placeId,
    sessionToken: sessionToken);

print("\nDetails :");
print(details.result.formattedAddress);
print(details.result.formattedPhoneNumber);
print(details.result.url);

} else {
print(res.errorMessage);
}

places.dispose();
}

Issue:
I ran this code which i found in the example and i got an error.

error:
You must use an API key to authenticate each request to Google Maps Platform APIs.

what i tried:
my api key has worked on
final places = new GoogleMapsPlaces(apiKey: "API_KEY");
but when i used final
places = new GoogleMapsPlaces(apiKey: Platform.environment["API_KEY"]);
it gave me that error.

unable to import

It seems that I am unable to import from this package.
image

my pubspec includes the correct line, I think...

  location: ^1.1.7
  google_maps_webservice: ^0.0.3

I have no trouble using , e.g., the location package.
Is this a problem with the package, or a problem in my configuration and usage?

Dart 2 typing issue

[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
type 'List' is not a subtype of type 'List<String>' in type cast where
  List is from dart:core
  List is from dart:core
  String is from dart:core

#0      Object._as (dart:core/runtime/libobject_patch.dart)
#1      new Prediction.fromJson (package:google_maps_webservice/src/places.dart:621:25)
#2      PlacesAutocompleteResponse._predictions (package:google_maps_webservice/src/places.dart:572:27)
#3      new PlacesAutocompleteResponse.fromJson (package:google_maps_webservice/src/places.dart:580:11)
#4      GoogleMapsPlaces._decodeAutocompleteResponse (package:google_maps_webservice/src/places.dart:263:11)
#5      GoogleMapsPlaces.autocomplete (package:google_maps_webservice/src/places.dart:115:12)
<asynchronous suspension>

To temporary fix it: lasseschmitt@b3424ce

I hope this is just a dart2 issue and will be solved soon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.