liodali / osm_flutter

OpenStreetMap plugin for flutter
https://pub.dev/packages/flutter_osm_plugin
MIT License
239 stars 98 forks source link

Unhandled Exception: FormatException: Unexpected character (at character 1) #570

Closed Joesta closed 1 week ago

Joesta commented 2 weeks ago

OSM is throwing FormatException when I land into the MAP view page where I have implmeneted the search and pick location. Please see the below exception.

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Unexpected character (at character 1) E/flutter (19448): E/flutter (19448): ^ E/flutter (19448): E/flutter (19448): #0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1465:5) E/flutter (19448): #1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1332:9) E/flutter (19448): #2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:933:22) E/flutter (19448): #3 _parseJson (dart:convert-patch/convert_patch.dart:36:10) E/flutter (19448): #4 JsonDecoder.convert (dart:convert/json.dart:610:36) E/flutter (19448): #5 JsonCodec.decode (dart:convert/json.dart:216:41) E/flutter (19448): #6 jsonDecode (dart:convert/json.dart:155:10) E/flutter (19448): #7 _OpenStreetMapSearchAndPickState.setNameCurrentPosAtInit (package:open_street_map_search_and_pick/open_street_map_search_and_pick.dart:129:9) E/flutter (19448):

OSM plugin version used = flutter_osm_plugin: ^1.3.5.

Please assist.

liodali commented 2 weeks ago

I dont think related to the map issue since in your log error Its json parsing issue. without example from your code I cannot help to solve the issue. provide us more information

Joesta commented 2 weeks ago

I dont think related to the map issue since in your log error Its json parsing issue. without example from your code I cannot help to solve the issue. provide us more information

Hi Liodali,

Please see the code snipped below

Widget _getIncidentmap(IncidentState state) { return OpenStreetMapSearchAndPick( buttonTextStyle: white16MediumTextStyle, buttonColor: // state is! InitiatingReportingState ? ThemeColors.transparent : ThemeColors.secondaryColor, buttonText: 'Capture Incident at Location', locationPinIconColor: ThemeColors.primaryColor, locationPinText: "", locationPinIcon: Icons.location_pin, locationPinTextStyle: orange12NnormalTextStyle, onPicked: (pickedData) { print("lati"+pickedData.latLong.latitude.toString()); print(pickedData.latLong.longitude); print(pickedData.address); print(pickedData.addressName); _onGetRouteSectionPressed( pickedData.latLong.latitude, pickedData.latLong.longitude); }, ); }

void _onGetRouteSectionPressed(double latitude, double longitude) { showLoaderDialog(context); BlocProvider.of(context).add( InitiateRouteSectionPointEvent(latitude, longitude), ); }

liodali commented 2 weeks ago

from where you get OpenStreetMapSearchAndPick we dont have that widget in our plugin which package do you use for that ?

Joesta commented 2 weeks ago

_getIncidentmap

It's coming from this package:

'package:open_street_map_search_and_pick/open_street_map_search_and_pick.dart'

liodali commented 1 week ago

you're in the wrong github repo this is package repo https://github.com/AbduzZami/open_street_map_search_and_pick