fireEvent method
Simulates a widget lifecycle/telemetry event from the page, by its
bridge wire name — decoded through the same mapFeedBridgeEvent the
real FeedPlacement uses internally, for the platform the test runs as
(defaultTargetPlatform), so fireEvent('fill') behaves like a real
fill message rather than requiring the caller to know the
TeadsAdEvent it maps to. A name mapFeedBridgeEvent can't map is
dropped, as the real widget and both native placements drop it.
Unlike the real widget this fires straight away, with no fill gate: a test asking for an event gets it.
The slot takes no height until fill, then
MockFeedPlacement.filledHeight. A no-fill before fill keeps it at
0 for good; one after fill changes nothing. That is the real widget's
rule on iOS, where a filled feed has reported its height. The mock has
no height reports, so it does not model Android's, where the real slot
can also take a height the page reports before fill (see
feedSlotHeight).
Implementation
void fireEvent(String name, [Map<String, dynamic>? data]) {
eventCallCount++;
if (name == feedFillEventName && !_closed && !_filled) {
setState(() => _filled = true);
} else if (name == feedNoFillEventName) {
_closed = true;
}
if (mapFeedBridgeEvent(name, data, platform: defaultTargetPlatform)
case (final event, final payload)) {
emitFeedEvent(widget.onEvent, event, payload);
}
}