List<dynamic>? listToJson<T>(List<dynamic>? list, Object? Function(T) toJson) => list?.map((e) => toJson(e)).toList();