In InvocationMessageExtensions.fromJson, json['arguments'] is mapped to a list of items, each one casted to Object.
Besides being a useless cast (since InvocationMessage.arguments is still defined as List<dynamic>) it is also dangerous because if arguments contains null the cast will fail and an exception will be thrown.
I suggest to remove the map function and assign arguments directly to json['arguments'] as List?, leaving to the consumer of the message the responsibility of managing the list.
In
InvocationMessageExtensions.fromJson
,json['arguments']
is mapped to a list of items, each one casted toObject
. Besides being a useless cast (sinceInvocationMessage.arguments
is still defined asList<dynamic>
) it is also dangerous because ifarguments
containsnull
the cast will fail and an exception will be thrown.https://github.com/jamiewest/signalr_core/blob/00a3cb78ea93b9b2d243f0b2cb2900ea485fdb7b/lib/src/json_hub_protocol.dart#L185
I suggest to remove the map function and assign
arguments
directly tojson['arguments'] as List?
, leaving to the consumer of the message the responsibility of managing the list.