Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PlusCode can be null #63

Open
kirpit opened this issue Oct 22, 2023 · 1 comment
Open

[BUG] PlusCode can be null #63

kirpit opened this issue Oct 22, 2023 · 1 comment

Comments

@kirpit
Copy link

kirpit commented Oct 22, 2023

Experiencing this unhandled exception when requesting details of some places with plusCode and the Places API doesn't provide plus code information:

E/flutter (28807): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast
E/flutter (28807): #0      _$$_PlusCodeFromJson (package:flutter_google_places_sdk_platform_interface/src/types/plus_code.g.dart:10:42)
E/flutter (28807): #1      new _$_PlusCode.fromJson (package:flutter_google_places_sdk_platform_interface/src/types/plus_code.freezed.dart:115:7)
E/flutter (28807): #2      _$PlusCodeFromJson (package:flutter_google_places_sdk_platform_interface/src/types/plus_code.freezed.dart:18:20)
E/flutter (28807): #3      new PlusCode.fromJson (package:flutter_google_places_sdk_platform_interface/src/types/plus_code.dart:22:7)
E/flutter (28807): #4      _$$_PlaceFromJson (package:flutter_google_places_sdk_platform_interface/src/types/place.g.dart:37:22)
E/flutter (28807): #5      new _$_Place.fromJson (package:flutter_google_places_sdk_platform_interface/src/types/place.freezed.dart:405:7)
E/flutter (28807): #6      _$PlaceFromJson (package:flutter_google_places_sdk_platform_interface/src/types/place.freezed.dart:18:17)
E/flutter (28807): #7      new Place.fromJson (package:flutter_google_places_sdk_platform_interface/src/types/place.dart:46:7)
E/flutter (28807): #8      FlutterGooglePlacesSdkMethodChannel._responseFromPlaceDetails (package:flutter_google_places_sdk_platform_interface/method_channel_flutter_google_places_sdk.dart:106:38)
E/flutter (28807): <asynchronous suspension>
E/flutter (28807): #9      FlutterGooglePlacesSdk._callMethod (package:flutter_google_places_sdk/flutter_google_places_sdk.dart:64:12)
E/flutter (28807): <asynchronous suspension>
E/flutter (28807): ...

Re-produce example:

  1. Go to "Bowen, Queensland 4805 Australia"
  2. Do a location bias search for "Dog off-leash Beach"
  3. There are 3 of them in the suburb and requesting details for any of them are throwing the above exception.

The error is on specific type casting:

compoundCode: json['compoundCode'] as String,

which is null sometimes.

@kirpit kirpit changed the title [BUG] PlusCode can be empty [BUG] PlusCode can be null Oct 22, 2023
@matanshukry
Copy link
Owner

@kirpit can you share the exact place, or perhaps how to reproduce it using the example?
I tired to look for just "Dog off-leash Beach", got 5 results - and managed to "Fetch place" on all of them with the latest released version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants