writeValueAsString abstract method

String writeValueAsString(
  1. Object? value, [
  2. ObjectMapperType mapWith = ObjectMapperType.JSON
])

Serializes a Dart object into a structured format string.

The format can be JSON, YAML, XML, or any supported representation depending on the configuration or generator provided.

The active NamingStrategy, annotations, and converters are applied.

Example

final dataString = mapper.writeValueAsString(user); 

Implementation

String writeValueAsString(Object? value, [ObjectMapperType mapWith = ObjectMapperType.JSON]);