MarkerShapeConverter class

A JSON converter for MarkerShape class.

This converter serializes MarkerShape objects to JSON using their toJson method, and deserializes JSON maps back to MarkerShape 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 {
  @MarkerShapeConverter()
  final MarkerShape? shape; // null = use theme default

  Port(this.shape);
}

Constructors

MarkerShapeConverter()
Creates a const instance of MarkerShapeConverter.
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) MarkerShape?
Converts a JSON map to a MarkerShape object, or null if json is null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(MarkerShape? shape) Map<String, dynamic>?
Converts a MarkerShape object to a JSON map, or null if shape is null.
toString() String
A string representation of this object.
inherited

Operators

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