writeObjectList<T> method
Implementation
Future<void> writeObjectList<T>(
String key,
List<T> objects,
dynamic Function(T obj) toJson,
) async {
try {
final List<dynamic> jsonList = objects.map((obj) => toJson(obj)).toList();
final String jsonString = json.encode(jsonList);
await write(key, jsonString);
} catch (e) {
print('Error storing object list: $e');
}
}