micimize / graphql-to-dart

generate dart classes and respective JsonSerializable transcoders
42 stars 8 forks source link

Feature Request: fromJson() constructor #34

Open isaiahtaylorhh opened 4 years ago

isaiahtaylorhh commented 4 years ago

https://stackoverflow.com/questions/47523725/dart-map-to-class

If a fromJson() constructor is added to the classes, it would increase operability with https://github.com/zino-app/graphql-flutter :

final customer = Customer.fromJson(myQueryResult.data);
micimize commented 4 years ago

This should already be generated in the case of actual serializables: https://github.com/micimize/graphql-to-dart/blob/bee58790f36c708fbb674d6cd09ef4794abc4438/example/lib/graphql/hero_for_episode.gql.dart#L305-L311