createChannel method Null safety

Future<PhoenixChannel> createChannel(
  1. {required String websocketUri,
  2. Map<String, String>? params}

create a new phoenix socket from the given websocketUri, connect to it, and create a channel, and join it


static Future<PhoenixChannel> createChannel(
    {required String websocketUri, Map<String, String>? params}) async {
  final socket = PhoenixSocket(websocketUri,
      socketOptions: PhoenixSocketOptions(params: params));
  await socket.connect();

  final channel = socket.addChannel(topic: '__absinthe__:control');
  final push = channel.join();
  await push.future;

  return channel;