pollEventsJson method

List<Map<String, dynamic>> pollEventsJson()

Every event queued since the last call, as the raw wire map, for a host that wants the escape hatch rather than the typed pollEvents.

An event's type names it, in snake_case, and the rest of the map is that event's fields.

Implementation

List<Map<String, dynamic>> pollEventsJson() {
  _alive();
  final decoded = _takeString(_bindings.pollEvents(_handle));
  if (decoded == null) {
    return const [];
  }
  final parsed = jsonDecode(decoded);
  if (parsed is! List) {
    return const [];
  }
  return parsed.whereType<Map<String, dynamic>>().toList();
}