serialize method
Serializes an object of type E to a string for storage.
This abstract method must be implemented by subclasses to define how objects are converted to strings for persistence. The serialization format is up to the implementation (JSON, XML, binary encoding, etc.), but it must be reversible by the deserialize method.
Parameters:
value- The object to serialize.
Returns: A string representation of the object that can be stored and later deserialized.
See also:
- deserialize for the reverse operation
Implementation
@override
String serialize(E value) => jsonEncode(toJson(value));