derTuca / flutter_google_places_picker

Google Places Autocomplete for Flutter
MIT License
18 stars 28 forks source link

Getting Unknown Error at PluginGooglePlacePicker.showAutocomplete() #29

Closed kasimr-oxc closed 4 years ago

kasimr-oxc commented 4 years ago

I'm getting following error while running this app in Emulator with latest Google Play Services installed.

I/flutter ( 7956): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
I/flutter ( 7956): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
I/flutter ( 7956): <asynchronous suspension>
I/flutter ( 7956): #2      PluginGooglePlacePicker.showAutocomplete (package:google_places_picker/google_places_picker.dart:50:24)
I/flutter ( 7956): #3      _HomePageState._onPlacePicker (package:dockhere/ui/boater/home_page.dart:1236:49)
I/flutter ( 7956): <asynchronous suspension>
I/flutter ( 7956): #4      _HomePageState.build.<anonymous closure> (package:dockhere/ui/boater/home_page.dart:188:21)
I/flutter ( 7956): #5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
I/flutter ( 7956): #6      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
I/flutter ( 7956): #7      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
I/flutter ( 7956): #8      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:199:7)
I/flutter ( 7956): #9      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:467:9

pubspec.yaml

google_places_picker: ^2.1.0+2
  void _onPlacePicker(BuildContext context) async {
    await PluginGooglePlacePicker.initialize(
      androidApiKey: Config.mapApiKey,
      iosApiKey: Config.mapApiKey,
    ).catchError(defaultCatchError);

    final place = await PluginGooglePlacePicker.showAutocomplete(
      mode: PlaceAutocompleteMode.MODE_OVERLAY,
      typeFilter: TypeFilter.CITIES,
    ).catchError(defaultCatchError);

    if (place == null) {
      return;
    }

    if (!kReleaseMode) {
      print('place is $place');
    }
  }

  void defaultCatchError(e, stackTrace) {
    print(stackTrace);
  }
kasimr-oxc commented 4 years ago

I forgot to enable 'Place API' from developer console.