json_serializable_flutter_converters 1.0.0  json_serializable_flutter_converters: ^1.0.0 copied to clipboard
json_serializable_flutter_converters: ^1.0.0 copied to clipboard
JsonConverters for Flutter/material types
JsonSerializable converters to convert flutter types to and from JSON
Features #
- Full test coverage
- Ready-made converters for flutter types
Supports:
- Color
- DateTimeRange
- Size
Usage #
@JsonSerializable(converters: [
  SizeConverter(),
  DateTimeRangeConverter(),
  ColorConverter(),
])
class Model {
  final Color color;
  final DateTimeRange dateTimeRange;
  final Size size;
  Model({
    required this.color,
    required this.dateTimeRange,
    required this.size,
  });
  factory Model.fromJson(Map<String, dynamic> json) => _$ModelFromJson(json);
  Map<String, dynamic> toJson() => _$ModelToJson(this);
}
Other packages #
If you need ready-made JsonSerializable converters for other common types, take a look at these packages: