canSerialize abstract method

bool canSerialize(
  1. Class type
)

Returns whether the given type can be serialized by the system.

Implementations should determine if a registered serializer or converter exists for the specified class type T.

Returns:

  • true → if the type can be serialized into a transferable format (e.g., an object).
  • false → if no compatible serializer is available.

Example

if (serializer.canSerialize(Class<User>)) {
  final json = serializer.serialize(user);
}

Implementation

bool canSerialize(Class type);