SizeConverter class

A JSON converter for Flutter's Size class.

This converter serializes Size objects to JSON as a map with 'width' and 'height' keys, and deserializes JSON maps back to Size objects.

Example JSON representation:

{
  "width": 300.0,
  "height": 200.0
}

Usage with json_serializable:

@JsonSerializable()
class MyClass {
  @SizeConverter()
  final Size dimensions;

  MyClass(this.dimensions);
}

See also:

Constructors

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

Operators

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