json_converters_lite

Last updated:

0 purchases

json_converters_lite Image
json_converters_lite Images
Add to Cart

Description:

json converters lite

Easily convert common Dart data types into a json compatible ones.

Getting Started
Installation
Usage
Contributing
FAQ

Getting Started #
This package provides a unified way to work with Dart data type serialization.
All converters implement the JsonConverter interface which has two methods:

toJson, which serializes the value.
fromJson, which deserializes the value.

Each converter in this package has a nullable and non-nullable variation.
A value passed to the non-nullable converter should be also non-nullable.
The name of the nullable converter starts with optional. It may return a
nullable value.
For a complete example, see Example tab.
Installation #
This is a standalone helper package which does not have any dependencies.
In general, put the reference to this package under dependencies in your
pubspec.yaml.
dependencies:
json_converters:
copied to clipboard
Usage #
To use this package, import it in your code:
import 'package:json_converters_lite/json_converters_lite.dart';
copied to clipboard
And use any of the currently available converters, currently featuring:

BoolConverter, which converts a bool to an int.
DateTimeConverter, which converts a DateTime to the ISO8601 string.
DurationConverter, which gets a total amount of seconds from Duration.
EnumConverter, which serializes Enum value as string from it's name.
IterableConverter, which takes the other converter as an argument and
serializes each value in the Iterable with that converter.

Also, you can create your own converters and use them, by implementing the
JsonConverter interface.
Contributing #
You can contibute by designing your own converters and proposing them to be
added to this package. Also, any bug reports are appreciated.
FAQ #
Why create a package for such basic features? #
Because, these features are frequently used in different projects. Thus, it is
very useful and convenient to have a consistent code base between projects.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.