Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions json_annotation/lib/src/json_serializable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,25 @@ class JsonKey {

/// A top-level [Function] to use when deserializing the associated JSON
/// value to the annotated field.
///
/// The [Function] should take one argument that maps to the expected JSON
/// value and return a value that can be assigned to the type of the annotated
/// field.
///
/// When creating a class that supports both `toJson` and `fromJson`
/// (the default), you should also set [toJson] if you set [fromJson].
/// Values returned by [toJson] should "round-trip" through [fromJson].
final Function fromJson;

/// A top-level [Function] to use when serializing the annotated field to
/// JSON.
///
/// The [Function] should take one argument that is compatible with the field
/// being serialized and return a JSON-compatible value.
///
/// When creating a class that supports both `toJson` and `fromJson`
/// (the default), you should also set [fromJson] if you set [toJson].
/// Values returned by [toJson] should "round-trip" through [fromJson].
final Function toJson;

/// Creates a new [JsonKey].
Expand Down
2 changes: 1 addition & 1 deletion json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_annotation
version: 0.2.4-dev
version: 0.2.4
description: Annotations for the json_serializable package
homepage: https://github.com/dart-lang/json_serializable
author: Dart Team <misc@dartlang.org>
Expand Down