Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Add annotation and fromJson and toJson methods to all classes in the file #2

Description

@Morteza-Rastgoo

If there is more than a class in a file, the plugin fails to add methods to them.

@JsonSerializable()
class CurrenciesPairsResponse {
  bool status;
  String message;
  DataBean data;

  CurrenciesPairsResponse(this.status, this.message, this.data);

  factory CurrenciesPairsResponse.fromJson(Map<String, dynamic> json) =>
      _$CurrenciesPairsResponseFromJson(json);

  Map<String, dynamic> toJson() => _$CurrenciesPairsResponseToJson(this);


}

@JsonSerializable()
class DataBean {
  List<Currency> pairs;
  List<Pair> favorites;

  DataBean(this.pairs, this.favorites);

  factory DataBean.fromJson(Map<String, dynamic> json) =>
      _$DataBeanFromJson(json);

  Map<String, dynamic> toJson() => _$DataBeanToJson(this);


}

@JsonSerializable()
class Currency {
  int id;
  String code;
  String name;
  int subUnit;
  List<Pair> pairs;

  Currency(this.id, this.code, this.name, this.subUnit, this.pairs);

  factory Currency.fromJson(Map<String, dynamic> json) =>
      _$CurrencyFromJson(json);

  Map<String, dynamic> toJson() => _$CurrencyToJson(this);


}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions