ToonCodec class

Codec for TOON (Token-Oriented Object Notation) format

This codec provides encoding and decoding functionality similar to dart:convert's JsonCodec but for the TOON format.

Example usage:

final codec = ToonCodec();

// Encoding
final data = {'name': 'Alice', 'age': 30};
final encoded = codec.encode(data);
print(encoded); // name: Alice\nage: 30

// Decoding
final decoded = codec.decode(encoded);
print(decoded); // {name: Alice, age: 30}
Inheritance

Constructors

ToonCodec({ToonOptions? options, ToonConverterRegistry? converterRegistry})
Creates a TOON codec with optional configuration
const

Properties

converterRegistry ToonConverterRegistry
Get the effective converter registry (with defaults)
no setter
decoder ToonDecoder
Returns the decoder of this, converting from T to S.
no setteroverride
encoder ToonEncoder
Returns the encoder from S to T.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
inverted Codec<String, Object?>
Inverts this.
no setterinherited
options ToonOptions
Get the effective options (with defaults)
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({ToonOptions? options, ToonConverterRegistry? converterRegistry}) ToonCodec
Create a codec with modified options
decode(String encoded) Object?
Decode a TOON format string to Dart objects
override
encode(Object? input) String
Encode a Dart object to TOON format string
override
fuse<R>(Codec<String, R> other) Codec<Object?, R>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override