Skip to content

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

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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