Skip to content

The method 'map' was called on null. Receiver: null Tried calling: map<Object>(Closure: (MapsObject<dynamic>) => Object) in google_maps_flutter #80508

@indrakumarprajapat

Description

@indrakumarprajapat

I added google_maps_flutter and google_directions_api packages. Using google auto complete i am getting the direction api result and drawing path on google map, but the following error we are getting in ios but the same code is working fine in android.
Its specificly we are getting on ios.

here are the package,
google_directions_api: ^0.8.0
google_maps_flutter: ^2.0.3

and i am using flutter 2.0

here is the error output,

======== Exception caught by widgets library =======================================================
The following NoSuchMethodError was thrown building GoogleMap(dirty, state: _GoogleMapState#076c7):
The method 'map' was called on null.
Receiver: null
Tried calling: map<Object>(Closure: (MapsObject<dynamic>) => Object)

The relevant error-causing widget was: 

When the exception was thrown, this was the stack: 
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      serializeMapsObjectSet (package:google_maps_flutter_platform_interface/src/types/utils/maps_object.dart:17:22)
#2      serializeMarkerSet (package:google_maps_flutter_platform_interface/src/types/utils/marker.dart:15:10)
#3      MethodChannelGoogleMapsFlutter.buildView (package:google_maps_flutter_platform_interface/src/method_channel/method_channel_google_maps_flutter.dart:454:23)
#4      _GoogleMapState.build (package:google_maps_flutter/src/google_map.dart:253:47)
...
====================================================================================================
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The method 'map' was called on null.
Receiver: null
Tried calling: map<MapEntry<MapsObjectId<Marker>, Marker>>(Closure: (Marker) => MapEntry<MapsObjectId<Marker>, Marker>)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      keyByMapsObjectId (package:google_maps_flutter_platform_interface/src/types/utils/maps_object.dart:10:54)
#2      new MapsObjectUpdates.from (package:google_maps_flutter_platform_interface/src/types/maps_object_updates.dart:25:52)
#3      new MarkerUpdates.from (package:google_maps_flutter_platform_interface/src/types/marker_updates.dart:14:15)
#4      _GoogleMapState._updateMarkers (package:google_maps_flutter/src/google_map.dart:311:23)
<asynchronous suspension>
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null.
Receiver: null
Tried calling: []("text")
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      new Time.fromMap (package:google_directions_api/src/directions.response.dart:1216:18)
#2      new Leg.fromMap (package:google_directions_api/src/directions.response.dart:606:27)
#3      new DirectionsRoute.fromMap.<anonymous closure> (package:google_directions_api/src/directions.response.dart:203:58)
#4      MappedListIterable.elementAt (dart:_internal/iterable.dart:411:31)
#5      ListIterator.moveNext (dart:_internal/iterable.dart:340:26)
#6      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#7      new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#8      new List.of (dart:core-patch/array_patch.dart:50:28)
#9      ListIterable.toList (dart:_internal/iterable.dart:211:44)
#10     IterableCommonExtension.mapList (pa<…>



Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions