Skip to content

🐛 Bug Report: realtimeMessage.fromMap crashes with _Map<String, dynamic> is not a subtype of Iterable<dynamic> #302

@yassir150

Description

@yassir150

👟 Reproduction steps

  1. Set up an Appwrite Realtime subscription on a collection/document channel (e.g., messaging).
  2. Trigger a document creation event (e.g., send a message that creates a document in the subscribed collection).
  3. The Realtime WebSocket receives the event of type "event".
  4. The SDK attempts to parse the incoming event data via RealtimeMessage.fromMap().
  5. The app crashes with an unhandled exception.

👍 Expected behavior

The RealtimeMessage.fromMap() factory constructor should correctly parse the incoming WebSocket event data regardless of whether the server sends events or channels as a List or a Map. The Realtime subscription callback should fire with a valid RealtimeMessage object containing the event payload.

👎 Actual Behavior

E/flutter (16642): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'Iterable<dynamic>'
E/flutter (16642): #0      new RealtimeMessage.fromMap (package:appwrite/src/realtime_message.dart:57:47)
E/flutter (16642): #1      RealtimeMixin._createSocket.<anonymous closure> (package:appwrite/src/realtime_mixin.dart:100:45)
E/flutter (16642): #2      _RootZone.runUnaryGuarded (dart:async/zone.dart:1778:10)
...

🎲 Appwrite version

Version 2.0.x

💻 Operating system

Windows

🧱 Your Environment

Flutter app using BLoC pattern for state management
Appwrite Realtime subscriptions on tablesdb/tables channels
Standard Appwrite Cloud

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions