rfc_3339_date_time_serializer 1.0.1

  • Readme
  • Changelog
  • Installing
  • 60

rfc_3339_date_time_serializer #

An RFC3339DateTimeSerializer serializer class for built_value, created to address the issue about Dart's DateTime.parse not working with RFC 3339.

Why is this package needed? #

ISO 8601 has a character limit for time-secfrac part equal to 6. RFC 3339 does not have that limit. Thanks to this, datetimes introducing more than 6 characters in time-secfrac are invalid for DateTime.parse, because it works only with ISO 8601.

For example, Go's encoding/json serializes dates with 7 time-secfrac characters.

Usage #

In your serializers.dart:

import 'rfc_3339_date_time_serializer/rfc_3339_date_time_serializer.dart';

@SerializersFor(const [/* (...) */])
final Serializers modelsSerializers = (_$modelsSerializers.toBuilder()
      ..add(RFC3339DateTimeSerializer())) // this is the line you need to add

[1.0.1] #

  • Readme changes and reformatted code.

[1.0.0] #

  • Initial commit

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  rfc_3339_date_time_serializer: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:rfc_3339_date_time_serializer/rfc_3339_date_time_serializer.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and rfc_3339_date_time_serializer.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
built_value ^7.0.0 7.0.9
Transitive dependencies
built_collection 4.3.2
collection 1.14.12
fixnum 0.10.11
matcher 0.12.6
meta 1.1.8
path 1.6.4
quiver 2.1.3
stack_trace 1.9.3
Dev dependencies
test ^1.0.0