PortShapeConverter class

A JSON converter for PortShape class.

This converter serializes PortShape objects to JSON using their toJson method, and deserializes JSON maps back to PortShape objects using the factory constructor.

Example JSON representation:

{
  "type": "circle"
}

For shapes with orientation:

{
  "type": "triangle",
  "orientation": "right"
}

Usage with json_serializable:

@JsonSerializable()
class Port {
  @PortShapeConverter()
  final PortShape shape;

  Port(this.shape);
}

Constructors

PortShapeConverter()
Creates a const instance of PortShapeConverter.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

fromJson(Map<String, dynamic> json) PortShape
Converts a JSON map to a PortShape object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(PortShape shape) Map<String, dynamic>
Converts a PortShape object to a JSON map.
toString() String
A string representation of this object.
inherited

Operators

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