I am working on a map application, which uses GoogleMaps, but I am having problems on the page that should display the map. Trying to use the MapView gives me the error "Item type 'MapView<dynamic, dynamic>' cannot be assigned to list type 'Widget'." I appreciate if someone can tell me how to fix this. Thank you
@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocBuilder<LocationBloc, LocationState>(
builder: (context, locationState) {
if (locationState.lastKnownLocation == null) {
return const Center(child: Text('Espere por favor...'));
}
return BlocBuilder<MapBloc, MapState>(
builder: (context, mapState) {
Map<String, Polyline> polylines = Map.from( mapState.polylines );
if ( !mapState.showMyRoute ) {
polylines.removeWhere((key, value) => key == 'myRoute');
}
return SingleChildScrollView(
child: Stack(
children: [
MapView(
initialLocation: locationState.lastKnownLocation!,
polylines: polylines.values.toSet(),
markers: mapState.markers.values.toSet(),
),
SearchBar(),
const ManualMarker(),
],
),
);
},
);
},
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: const [
BtnToggleUserRoute(),
BtnFollowUser(),
BtnCurrentLocation(),
],
),
);
}
}