json_serializable_flutter_converters 1.0.0 copy "json_serializable_flutter_converters: ^1.0.0" 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);
}
copied to clipboard

Other packages #

If you need ready-made JsonSerializable converters for other common types, take a look at these packages:

0
likes
130
points
20
downloads

Publisher

verified publisherdogeek.me

Weekly Downloads

2024.09.30 - 2025.04.14

JsonConverters for Flutter/material types

Repository (GitHub)
View/report issues

Topics

#json-serializable #flutter #codegen #converter

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, json_annotation

More

Packages that depend on json_serializable_flutter_converters