AgoraIO-Extensions / Agora-Flutter-RTM-SDK

Flutter wrapper around the Agora Real Time Message SDKs for Android and iOS
MIT License
106 stars 73 forks source link

Unhandled Exception when calling onPeersOnlineStatusChanged #146

Closed Mo0Khaled closed 1 year ago

Mo0Khaled commented 1 year ago

I am getting an Exception :

type '_Map<Object?, Object?>' is not a subtype of type 'Map<String, int>'

I think this is because

this line
final map = Map.from(event['data']);

will be Map<Object?, Object?>

and you are parsing it like that :

Map<String, int> peersStatus = map["peersStatus"];

so it will throw this error.

can I make a pull request on it ?

or can I solved in other way?

Mo0Khaled commented 1 year ago

so, the issue is

the value returned from the map is

String, Bool

not String , int

Mo0Khaled commented 1 year ago

still get the same issue !

but with map<string,bool>

I suggest we loop over the map["peersStatus"] and cast each key, value?