encodeChanelId static method

String encodeChanelId(
  1. String name,
  2. Map? params
)

Used to pass (maybe) fix the name of the channel and put it in params

Implementation

static String encodeChanelId(String name, Map? params) {
  final fullChannelName = name.endsWith('Channel') ? name : '${name}Channel';

  /// Adding the channel name to params
  Map<String, dynamic> channelParams = params == null ? {} : Map.from(params);
  channelParams['channel'] ??= fullChannelName;

  return jsonEncode(SplayTreeMap.from(channelParams));
}