userListToJson function
Converts a UserList object into a JSON string.
This function takes a UserList object, converts it to a map using the toJson
method,
and then encodes the map as a JSON string.
Parameters:
data
- A UserList object.
Returns: A JSON string representing the list of users.
Implementation
String userListToJson(UserList data) => json.encode(data.toJson());