Skip to content

Add support for retrofit. Object? with generics #64

@vanlooverenkoen

Description

@vanlooverenkoen
@JsonSerializable(genericArgumentFactories: true)
class Response<T> {
  int status;
  T value;
}

will require 2 functions

  T Function(Object json) fromJsonT,
&
  Object Function(T value) toJsonT,

These 2 functions require an Object. -> retrofit is already compatible. They will generate the correct generic type. But the model generator will always use Map<String,dynamic>

We should have an option to generate something like this.

factory Project.fromJson(Object? json) => _$ProjectFromJson(json as Map<String, dynamic>);

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Highest prioenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions