MapEvent<T> class Null safety

Generic Event coming from the native side of Maps.

All MapEvents contain the mapId that originated the event. This should never be null.

The <T> on this event represents the type of the value that is contained within the event.

This class is used as a base class for all the events that might be triggered from a Map, but it is never used directly as an event type.

Do NOT instantiate new events like MapEvent<ValueType>(mapId, val) directly, use a specific class instead:

Do class NewEvent extend MapEvent<ValueType> when creating your own events. See below for examples: CameraMoveStartedEvent, MarkerDragEndEvent... These events are more semantic and pleasant to use than raw generics. They can be (and in fact, are) filtered by the instanceof-operator.

(See MethodChannelGoogleMapsFlutter.onCameraMoveStarted, for example)

If your event needs a position, alongside the value, do extends _PositionedMapEvent<ValueType> instead. This adds a LatLng position attribute.

If your event only needs a position, do extend _PositionedMapEvent<void> do NOT extend MapEvent<LatLng>. The former lets consumers of these events to access the .position property, rather than the more generic .value yielded from the latter.



MapEvent(int mapId, T value)
Build a Map Event, that relates a mapId with a given value. [...]


hashCode int
The hash code for this object. [...]
read-only, inherited
mapId int
The ID of the Map this event is associated to.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
value → T
The value wrapped by this event


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]