Open jopmiddelkamp opened 1 year ago
Describe the solution you'd like I'm using freezed in the example but in the background that is using this package.
I would like to have generated option for json serialization via isolates.
So that this:
@freezed class DisbursementEntity with _$DisbursementEntity { const factory DisbursementEntity({ required String asset, required String disbursementPlatformDomain, required String organizationName, required String signature, }) = _DisbursementEntity; static Future<DisbursementEntity> fromJsonStringCompute( String jsonString, ) async { final result = await compute( (jsonString) => DisbursementEntity.fromJson(jsonDecode(jsonString)), jsonString, ); return result; } factory DisbursementEntity.fromJson(Map<String, dynamic> json) => _$DisbursementEntityFromJson(json); } extension DisbursementEntityX on DisbursementEntity { Future<String> toJsonStringCompute() async { final result = await compute( (disbursement) => jsonEncode(disbursement.toJson()), this, ); return result; } }
Can become this:
@freezed class DisbursementEntity with _$DisbursementEntity { const factory DisbursementEntity({ required String asset, required String disbursementPlatformDomain, required String organizationName, required String signature, }) = _DisbursementEntity; static Future<DisbursementEntity> fromJsonStringCompute(String json) => _$DisbursementEntityFromJsonStringCompute(json); factory DisbursementEntity.fromJson(Map<String, dynamic> json) => _$DisbursementEntityFromJson(json); }
Describe the solution you'd like I'm using freezed in the example but in the background that is using this package.
I would like to have generated option for json serialization via isolates.
So that this:
Can become this: