Open YSDC opened 8 months ago
!!! EDIT I thought I had the same problem.
@freezed
class PushDeviceTransfer with _$PushDeviceTransfer {
@JsonSerializable(explicitToJson: true)
factory PushDeviceTransfer({
required String token,
required String? device,
}) = _PushDeviceTransfer;
factory PushDeviceTransfer.fromJson(Map<String, dynamic> json) =>
_$PushDeviceTransferFromJson(json);
}
Didn't seem to generate_data = value.toJson()
in my retrofit file, just _data = value
.
This was easily fixed by making the freezed class a sealed class eg.
class PushDeviceTransfer with _$PushDeviceTransfer {}
// to
sealed class PushDeviceTransfer with _$PushDeviceTransfer {}
Did you add this config to build.yaml
`global_options: freezed: runs_before:
@alexjane19 It's worked!!!
I updated many dependencies for an application developed in June, among them Retrofit.
Then, when I did a login to call to my server, I received no data. It appeared that Retrofit was not converting my object to json.
The code generated by RetrofitGenerator:
To make it work, I had to manually replace the line data: _data with data: _data.toJson(). Any Idea why?
I will add the implementation of my LoginRequest class to, and let me know if you need anything else to provide some help. Already a big thank you if you read my message :)