Skip to content

Compatibility with json_serializable #19

@realcr

Description

@realcr

Hi, thank you for your work on tuple!
Is there a recommended way to use tuple together with json_serializable?

For example, if I want to automatically serialize a class that looks like this:

@JsonSerializable(nullable: false)
class Person {
  final String firstName;
  final String lastName;
  final Tuple2<String,int> myTuple;

  Person({this.firstName, this.lastName, this.myTuple});

  factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json);
  Map<String, dynamic> toJson() => _$PersonToJson(this);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions