Reputation: 6418
I'm trying to listen for MapEvents
from MapController()
as suggested here https://github.com/fleaflet/flutter_map/issues/877#issuecomment-825545206 as
@override
void initState() {
super.initState();
_mapController.mapEventStream.where((event) => event is MapEventMoveEnd).listen((event) {
// TODO: You code
});
}
the problem is that I don't have mapEventStream
available option in _mapController
.
Is it just a package version problem or what am I doing wrong??
I'm still using flutter_map: ^0.10.1 as I'd have to update many other packages..
Upvotes: 0
Views: 948
Reputation: 16
Yes, your package version is too old to make use of that feature. You need at least 0.11.0 to use mapEventStream
, though you may be able to get away with 0.10.1+1 depending on your use case.
Looking at the commit history for lib/src/map/map.dart (the file with MapController code), two commits are of interest:
MapPosition
stream called position
was added.position
is changed to mapEventStream
and its stream type changed to emit MapEvent
objects.Looking now at the flutter_map version history, the earliest version that includes the first commit mentioned above is 0.10.1+1, and to get the latter form you need 0.11.0.
I have tested the existence of both getters in their respective versions in my editor.
Upvotes: 0