RequiredSizeConverter class

A non-nullable JSON converter for Flutter's Size class.

Similar to SizeConverter but for non-nullable Size fields. This converter serializes Size objects to JSON as a map with 'width' and 'height' keys, and deserializes JSON maps back to Size objects.

Usage with json_serializable:

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

  MyClass(this.dimensions);
}

Constructors

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

Operators

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