sefidgaran / signalr_client

A Flutter SignalR Client for ASP.NET Core
https://pub.dev/packages/signalr_netcore
MIT License
71 stars 111 forks source link

Handle Lists from backend #57

Open hashproton opened 1 year ago

hashproton commented 1 year ago

Hi, how can I handle lists from the backend. I have a List of string and I want to parse to dart objects.

The backend consists of returning a list of strings

 private static readonly Dictionary<string, string> userLookup = new();
 await Clients.All.SendAsync(
   Messages.USER.JOINED,
   JsonConvert.SerializeObject(userLookup.Select(x => x.Value)));

The frontend

 hubHelper.hubConnection.on('USER_JOINED', (args) {
    var response = args![0]! as List<String>;
    print(response);
  });
image

I can do the trim, but it's not supposed to deserialize the object into a List in dart?