When I press Set Current Location button, nothing happens and the error in the title is thrown.
The code piece that is shown when i click on the error is:
Widget _buildSelectButton() {
return Positioned(
top: widget.selectLocationButtonPositionTop,
bottom: widget.selectLocationButtonPositionBottom,
left: widget.selectLocationButtonPositionLeft,
right: widget.selectLocationButtonPositionRight,
child: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: WideButton(
widget.selectLocationButtonText,
onPressed: () async {
setState(() {
isLoading = true;
});
pickData().then((value) {
widget.onPicked(value);
}, onError: (e) => onError(e)).whenComplete(() => setState(() {
isLoading = false;
}));
},
style: widget.selectLocationButtonStyle,
textColor: widget.selectLocationTextColor,
width: widget.selectLocationButtonWidth,
height: widget.selectLocationButtonHeight,
),
),
),
);
}
Also the search bar does not work and presents the following error when I type anything.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'List' in type cast
try {
String url =
'https://nominatim.openstreetmap.org/search?q=$value&format=json&polygon_geojson=1&addressdetails=1&accept-language=${widget.mapLanguage}';
var response = await client.post(Uri.parse(url));
var decodedResponse =
jsonDecode(utf8.decode(response.bodyBytes))
as List<dynamic>;
_options = decodedResponse
.map((e) => OSMdata(
displayname: e['display_name'],
latitude: double.parse(e['lat']),
longitude: double.parse(e['lon'])))
.toList();
setState(() {});
}