This repository was archived by the owner on May 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on May 8, 2023. It is now read-only.
Exception thrown when using addMarkers #17
Copy link
Copy link
Open
Description
Activity
var usersObject = Users.fromJson(Map<String, dynamic>.from(jsonDecode(users))); setState(() { mapController.addMarkers(markers: usersObject.toMarkers()); });
In this case
mapControlleris an instance of StatefulMapControllersetState(() { usersObject.toMarkers().forEach((name, marker) { mapController.addMarker(marker: marker, name: name); }); });
Also just tried to use
addMarkerinstead but same error :══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter (23709): The following NoSuchMethodError was thrown building StreamBuilder<int>(dirty, state: I/flutter (23709): _StreamBuilderBaseState<int, AsyncSnapshot<int>>#4edd9): I/flutter (23709): The method 'call' was called on null. I/flutter (23709): Receiver: null I/flutter (23709): Tried calling: call() I/flutter (23709): I/flutter (23709): The relevant error-causing widget was: I/flutter (23709): StreamBuilder<int> I/flutter (23709): file:///C:/Users/Dixmi/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_map-0.9.0/lib/src/layer/marker_layer.dart:110:12 I/flutter (23709): I/flutter (23709): When the exception was thrown, this was the stack: I/flutter (23709): #0 MarkerLayer.build.<anonymous closure> (package:flutter_map/src/layer/marker_layer.dart:134:39) I/flutter (23709): #1 StreamBuilder.build (package:flutter/src/widgets/async.dart:509:81) I/flutter (23709): #2 _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:127:48) I/flutter (23709): #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4619:28) I/flutter (23709): #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4502:15) I/flutter (23709): #5 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11) I/flutter (23709): #6 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5) I/flutter (23709): #7 StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5) I/flutter (23709): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15) I/flutter (23709): #9 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16) I/flutter (23709): #10 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5) I/flutter (23709): #11 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2627:33) I/flutter (23709): #12 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:20) I/flutter (23709): #13 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5) I/flutter (23709): #14 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15) I/flutter (23709): #15 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9) I/flutter (23709): #16 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:861:7) I/flutter (23709): (elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch) I/flutter (23709): I/flutter (23709): ════════════════════════════════════════════════════════════════════════════════════════════════════
Metadata
Metadata
Assignees
Labels
No labels
I have this exception every times I try to add multiples markers at once.
Here is a part of the code I use :
And this is the Users class :
JSON Pattern :
{ "Test 2": { "latitude": <value>, "longitude": <value>, "accuracy": <value> }, "Test": { "latitude": <value>, "longitude": <value>, "accuracy": <value> }, "Test 3": { "latitude": <value>, "longitude": <value>, "accuracy": <value> } }I'm using Location from background_location but values are the same.
For LatLng I'm using latlong.dart
Is anyone can help me on this plz ?