diff --git a/packages/postman/lib/models/postman_collection.dart b/packages/postman/lib/models/postman_collection.dart index 2e198e9c..4bfd8091 100644 --- a/packages/postman/lib/models/postman_collection.dart +++ b/packages/postman/lib/models/postman_collection.dart @@ -15,6 +15,10 @@ String postmanCollectionToJsonStr(PostmanCollection data) => @freezed class PostmanCollection with _$PostmanCollection { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory PostmanCollection({ Info? info, List? item, @@ -26,6 +30,10 @@ class PostmanCollection with _$PostmanCollection { @freezed class Info with _$Info { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Info({ @JsonKey(name: '_postman_id') String? postmanId, String? name, @@ -38,6 +46,10 @@ class Info with _$Info { @freezed class Item with _$Item { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Item({ String? name, List? item, @@ -50,6 +62,10 @@ class Item with _$Item { @freezed class Request with _$Request { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Request({ String? method, List
? header, @@ -63,6 +79,10 @@ class Request with _$Request { @freezed class Header with _$Header { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Header({ String? key, String? value, @@ -75,6 +95,10 @@ class Header with _$Header { @freezed class Url with _$Url { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Url({ String? raw, String? protocol, @@ -88,6 +112,10 @@ class Url with _$Url { @freezed class Query with _$Query { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Query({ String? key, String? value, @@ -99,6 +127,10 @@ class Query with _$Query { @freezed class Body with _$Body { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Body({ String? mode, String? raw, @@ -111,6 +143,10 @@ class Body with _$Body { @freezed class Options with _$Options { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Options({ Raw? raw, }) = _Options; @@ -121,6 +157,10 @@ class Options with _$Options { @freezed class Raw with _$Raw { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Raw({ String? language, }) = _Raw; @@ -130,6 +170,10 @@ class Raw with _$Raw { @freezed class Formdatum with _$Formdatum { + @JsonSerializable( + explicitToJson: true, + anyMap: true, + ) const factory Formdatum({ String? key, String? value, diff --git a/packages/postman/lib/models/postman_collection.freezed.dart b/packages/postman/lib/models/postman_collection.freezed.dart index ffab279a..ed05a265 100644 --- a/packages/postman/lib/models/postman_collection.freezed.dart +++ b/packages/postman/lib/models/postman_collection.freezed.dart @@ -133,7 +133,8 @@ class __$$PostmanCollectionImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$PostmanCollectionImpl implements _PostmanCollection { const _$PostmanCollectionImpl({this.info, final List? item}) : _item = item; @@ -337,7 +338,8 @@ class __$$InfoImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$InfoImpl implements _Info { const _$InfoImpl( {@JsonKey(name: '_postman_id') this.postmanId, @@ -571,7 +573,8 @@ class __$$ItemImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$ItemImpl implements _Item { const _$ItemImpl( {this.name, @@ -830,7 +833,8 @@ class __$$RequestImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$RequestImpl implements _Request { const _$RequestImpl( {this.method, final List
? header, this.body, this.url}) @@ -1038,7 +1042,8 @@ class __$$HeaderImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$HeaderImpl implements _Header { const _$HeaderImpl({this.key, this.value, this.type, this.disabled}); @@ -1253,7 +1258,8 @@ class __$$UrlImplCopyWithImpl<$Res> extends _$UrlCopyWithImpl<$Res, _$UrlImpl> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$UrlImpl implements _Url { const _$UrlImpl( {this.raw, @@ -1483,7 +1489,8 @@ class __$$QueryImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$QueryImpl implements _Query { const _$QueryImpl({this.key, this.value, this.disabled}); @@ -1695,7 +1702,8 @@ class __$$BodyImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$BodyImpl implements _Body { const _$BodyImpl( {this.mode, this.raw, this.options, final List? formdata}) @@ -1888,7 +1896,8 @@ class __$$OptionsImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$OptionsImpl implements _Options { const _$OptionsImpl({this.raw}); @@ -2029,7 +2038,8 @@ class __$$RawImplCopyWithImpl<$Res> extends _$RawCopyWithImpl<$Res, _$RawImpl> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$RawImpl implements _Raw { const _$RawImpl({this.language}); @@ -2210,7 +2220,8 @@ class __$$FormdatumImplCopyWithImpl<$Res> } /// @nodoc -@JsonSerializable() + +@JsonSerializable(explicitToJson: true, anyMap: true) class _$FormdatumImpl implements _Formdatum { const _$FormdatumImpl({this.key, this.value, this.type, this.src}); diff --git a/packages/postman/lib/models/postman_collection.g.dart b/packages/postman/lib/models/postman_collection.g.dart index 19424913..7e655e3a 100644 --- a/packages/postman/lib/models/postman_collection.g.dart +++ b/packages/postman/lib/models/postman_collection.g.dart @@ -6,25 +6,24 @@ part of 'postman_collection.dart'; // JsonSerializableGenerator // ************************************************************************** -_$PostmanCollectionImpl _$$PostmanCollectionImplFromJson( - Map json) => +_$PostmanCollectionImpl _$$PostmanCollectionImplFromJson(Map json) => _$PostmanCollectionImpl( info: json['info'] == null ? null - : Info.fromJson(json['info'] as Map), + : Info.fromJson(Map.from(json['info'] as Map)), item: (json['item'] as List?) - ?.map((e) => Item.fromJson(e as Map)) + ?.map((e) => Item.fromJson(Map.from(e as Map))) .toList(), ); Map _$$PostmanCollectionImplToJson( _$PostmanCollectionImpl instance) => { - 'info': instance.info, - 'item': instance.item, + 'info': instance.info?.toJson(), + 'item': instance.item?.map((e) => e.toJson()).toList(), }; -_$InfoImpl _$$InfoImplFromJson(Map json) => _$InfoImpl( +_$InfoImpl _$$InfoImplFromJson(Map json) => _$InfoImpl( postmanId: json['_postman_id'] as String?, name: json['name'] as String?, schema: json['schema'] as String?, @@ -39,48 +38,47 @@ Map _$$InfoImplToJson(_$InfoImpl instance) => '_exporter_id': instance.exporterId, }; -_$ItemImpl _$$ItemImplFromJson(Map json) => _$ItemImpl( +_$ItemImpl _$$ItemImplFromJson(Map json) => _$ItemImpl( name: json['name'] as String?, item: (json['item'] as List?) - ?.map((e) => Item.fromJson(e as Map)) + ?.map((e) => Item.fromJson(Map.from(e as Map))) .toList(), request: json['request'] == null ? null - : Request.fromJson(json['request'] as Map), + : Request.fromJson(Map.from(json['request'] as Map)), response: json['response'] as List?, ); Map _$$ItemImplToJson(_$ItemImpl instance) => { 'name': instance.name, - 'item': instance.item, - 'request': instance.request, + 'item': instance.item?.map((e) => e.toJson()).toList(), + 'request': instance.request?.toJson(), 'response': instance.response, }; -_$RequestImpl _$$RequestImplFromJson(Map json) => - _$RequestImpl( +_$RequestImpl _$$RequestImplFromJson(Map json) => _$RequestImpl( method: json['method'] as String?, header: (json['header'] as List?) - ?.map((e) => Header.fromJson(e as Map)) + ?.map((e) => Header.fromJson(Map.from(e as Map))) .toList(), body: json['body'] == null ? null - : Body.fromJson(json['body'] as Map), + : Body.fromJson(Map.from(json['body'] as Map)), url: json['url'] == null ? null - : Url.fromJson(json['url'] as Map), + : Url.fromJson(Map.from(json['url'] as Map)), ); Map _$$RequestImplToJson(_$RequestImpl instance) => { 'method': instance.method, - 'header': instance.header, - 'body': instance.body, - 'url': instance.url, + 'header': instance.header?.map((e) => e.toJson()).toList(), + 'body': instance.body?.toJson(), + 'url': instance.url?.toJson(), }; -_$HeaderImpl _$$HeaderImplFromJson(Map json) => _$HeaderImpl( +_$HeaderImpl _$$HeaderImplFromJson(Map json) => _$HeaderImpl( key: json['key'] as String?, value: json['value'] as String?, type: json['type'] as String?, @@ -95,13 +93,13 @@ Map _$$HeaderImplToJson(_$HeaderImpl instance) => 'disabled': instance.disabled, }; -_$UrlImpl _$$UrlImplFromJson(Map json) => _$UrlImpl( +_$UrlImpl _$$UrlImplFromJson(Map json) => _$UrlImpl( raw: json['raw'] as String?, protocol: json['protocol'] as String?, host: (json['host'] as List?)?.map((e) => e as String).toList(), path: (json['path'] as List?)?.map((e) => e as String).toList(), query: (json['query'] as List?) - ?.map((e) => Query.fromJson(e as Map)) + ?.map((e) => Query.fromJson(Map.from(e as Map))) .toList(), ); @@ -110,10 +108,10 @@ Map _$$UrlImplToJson(_$UrlImpl instance) => { 'protocol': instance.protocol, 'host': instance.host, 'path': instance.path, - 'query': instance.query, + 'query': instance.query?.map((e) => e.toJson()).toList(), }; -_$QueryImpl _$$QueryImplFromJson(Map json) => _$QueryImpl( +_$QueryImpl _$$QueryImplFromJson(Map json) => _$QueryImpl( key: json['key'] as String?, value: json['value'] as String?, disabled: json['disabled'] as bool?, @@ -126,14 +124,14 @@ Map _$$QueryImplToJson(_$QueryImpl instance) => 'disabled': instance.disabled, }; -_$BodyImpl _$$BodyImplFromJson(Map json) => _$BodyImpl( +_$BodyImpl _$$BodyImplFromJson(Map json) => _$BodyImpl( mode: json['mode'] as String?, raw: json['raw'] as String?, options: json['options'] == null ? null - : Options.fromJson(json['options'] as Map), + : Options.fromJson(Map.from(json['options'] as Map)), formdata: (json['formdata'] as List?) - ?.map((e) => Formdatum.fromJson(e as Map)) + ?.map((e) => Formdatum.fromJson(Map.from(e as Map))) .toList(), ); @@ -141,23 +139,22 @@ Map _$$BodyImplToJson(_$BodyImpl instance) => { 'mode': instance.mode, 'raw': instance.raw, - 'options': instance.options, - 'formdata': instance.formdata, + 'options': instance.options?.toJson(), + 'formdata': instance.formdata?.map((e) => e.toJson()).toList(), }; -_$OptionsImpl _$$OptionsImplFromJson(Map json) => - _$OptionsImpl( +_$OptionsImpl _$$OptionsImplFromJson(Map json) => _$OptionsImpl( raw: json['raw'] == null ? null - : Raw.fromJson(json['raw'] as Map), + : Raw.fromJson(Map.from(json['raw'] as Map)), ); Map _$$OptionsImplToJson(_$OptionsImpl instance) => { - 'raw': instance.raw, + 'raw': instance.raw?.toJson(), }; -_$RawImpl _$$RawImplFromJson(Map json) => _$RawImpl( +_$RawImpl _$$RawImplFromJson(Map json) => _$RawImpl( language: json['language'] as String?, ); @@ -165,8 +162,7 @@ Map _$$RawImplToJson(_$RawImpl instance) => { 'language': instance.language, }; -_$FormdatumImpl _$$FormdatumImplFromJson(Map json) => - _$FormdatumImpl( +_$FormdatumImpl _$$FormdatumImplFromJson(Map json) => _$FormdatumImpl( key: json['key'] as String?, value: json['value'] as String?, type: json['type'] as String?,