php_serializer library

Converts Php-Serialized objects into Dart and vice versa

Classes

GenerateDartClassCodeOnMissingDeserializationInformation Fallback Behavior
Generates dart code representing the passed instance The generated class contains all properties as final properties which allows the class-instances to be const. Additionally a static property phpSerializationObjectInformation is created which can be passed to phpSerialize and phpDeserialize.
GenerateMapOnMissingDeserializationInformation Fallback Behavior
Generates a Map<String, dynamic> for objects that do not have matching PhpSerializationObjectInformation.
NoMatchingObjectDeserializationInformation Fallback Behavior
Implement this interface to customize the action when there is not matching information for deserialization.
NoMatchingObjectSerializationInformation Fallback Behavior
Implement this interface to customize the action when there is not matching information for serialization.
PhpSerializationObjectInformation<T extends Object>
Contains information about complex objects which can be (de-)serialized
ThrowExceptionOnMissingDeserializationInformation Fallback Behavior
Throws an exception of type DeserializationException if there is no matching PhpSerializationObjectInformation for a class.
ThrowExceptionOnMissingSerializationInformation Fallback Behavior
Throws an exception of type SerializationException if there is no matching PhpSerializationObjectInformation for a class.

Functions

phpDeserialize(String serializedString, {List<PhpSerializationObjectInformation<Object>>? knownClasses, NoMatchingObjectDeserializationInformation? fallbackObjectDeserialization}) → dynamic
Parses a String which could be provided by Php via its function serialize() and returns the resulting object.
phpSerialize(dynamic serializeMe, {List<PhpSerializationObjectInformation<Object>>? knownClasses, NoMatchingObjectSerializationInformation? fallbackObjectSerialization}) String
Takes an object and converts it into a String which could be deserialized by Php via its function unserialize().

Exceptions / Errors

CustomDeserializationFailed
Deserialization of an object failed because the user-defined converter function threw an exception.
CustomSerializationFailed
Serialization of an object failed because the user-defined converter function threw an exception.
DeserializationException
Will be thrown in case phpDeserialize fails for some reason
InvalidSerializedString
Deserialization failed because the passed string was invalid
ObjectWithoutDeserializationInformationFound
Deserialization of an object failed because there was no matching PhpSerializationObjectInformation provided
ObjectWithoutSerializationInformationFound
Serialization of an object failed because there was no matching PhpSerializationObjectInformation provided
SerializationException
Will be thrown in case phpSerialize fails for some reason