encodeObjectList<T> method
Implementation
String? encodeObjectList<T>(List<T>? list, Map<String, dynamic> Function(T) toJson) {
if (list == null || list.isEmpty) return null;
try {
final encoded = list.map((item) => toJson(item)).toList();
return json.encode(encoded);
} catch (e) {
logger.e('JsonUtils encodeObjectList error: $e');
return null;
}
}