mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-07 08:00:50 +00:00
[DART2] A couple of bug fixes (#7969)
* Fixed a couple of problems with current implementation. 1) When encoding non-String header values, the client will forwar to parameterToString() for encoding. 2) fromJson() now accepts a dynamic value since the type transformer accepts a dynamic value. * Updated Pet Store files. * Proper spacing between blocks. * Adjust spacing. * Make fromJson() as a static function, thus not instantiating a new object if JSON is null. * Adjust doc for fromJson() function.
This commit is contained in:
parent
08c8296e33
commit
91e64f47fc
@ -69,19 +69,31 @@ class {{{classname}}} {
|
|||||||
final queryParams = <QueryParam>[];
|
final queryParams = <QueryParam>[];
|
||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
{{#hasQueryParams}}
|
||||||
|
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
if ({{{paramName}}} != null) {
|
if ({{{paramName}}} != null) {
|
||||||
{{/required}}
|
{{/required}}
|
||||||
queryParams.addAll(_convertParametersForCollectionFormat('{{{collectionFormat}}}', '{{{baseName}}}', {{{paramName}}}));
|
queryParams.addAll(_convertParametersForCollectionFormat('{{{collectionFormat}}}', '{{{baseName}}}', {{{paramName}}}));
|
||||||
{{^required}}
|
{{^required}}
|
||||||
}
|
}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{#headerParams}}
|
{{/hasQueryParams}}
|
||||||
headerParams['{{{baseName}}}'] = {{{paramName}}};
|
{{#hasHeaderParams}}
|
||||||
{{/headerParams}}
|
|
||||||
|
{{#headerParams}}
|
||||||
|
{{#required}}
|
||||||
|
headerParams['{{{baseName}}}'] = parameterToString({{{paramName}}});
|
||||||
|
{{/required}}
|
||||||
|
{{^required}}
|
||||||
|
if ({{{paramName}}} != null) {
|
||||||
|
headerParams['{{{baseName}}}'] = parameterToString({{{paramName}}});
|
||||||
|
}
|
||||||
|
{{/required}}
|
||||||
|
{{/headerParams}}
|
||||||
|
{{/hasHeaderParams}}
|
||||||
|
|
||||||
final contentTypes = <String>[{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}];
|
final contentTypes = <String>[{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
|
@ -6,118 +6,6 @@ class {{{classname}}} {
|
|||||||
{{/vars}}
|
{{/vars}}
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [{{{classname}}}] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
{{{classname}}}.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
{{#vars}}
|
|
||||||
{{#isDateTime}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
{{#pattern}}
|
|
||||||
: _dateEpochMarker == '{{{pattern}}}'
|
|
||||||
? DateTime.fromMillisecondsSinceEpoch(json['{{{baseName}}}'] as int, isUtc: true)
|
|
||||||
: DateTime.parse(json['{{{baseName}}}']);
|
|
||||||
{{/pattern}}
|
|
||||||
{{^pattern}}
|
|
||||||
: DateTime.parse(json['{{{baseName}}}']);
|
|
||||||
{{/pattern}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{#isDate}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
{{#pattern}}
|
|
||||||
: _dateEpochMarker == '{{{pattern}}}'
|
|
||||||
? DateTime.fromMillisecondsSinceEpoch(json['{{{baseName}}}'] as int, isUtc: true)
|
|
||||||
: DateTime.parse(json['{{{baseName}}}']);
|
|
||||||
{{/pattern}}
|
|
||||||
{{^pattern}}
|
|
||||||
: DateTime.parse(json['{{{baseName}}}']);
|
|
||||||
{{/pattern}}
|
|
||||||
{{/isDate}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{^isDate}}
|
|
||||||
{{#complexType}}
|
|
||||||
{{#isArray}}
|
|
||||||
{{#items.isArray}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
: (json['{{{baseName}}}'] as List).map(
|
|
||||||
{{#items.complexType}}
|
|
||||||
{{items.complexType}}.listFromJson(json['{{{baseName}}}'])
|
|
||||||
{{/items.complexType}}
|
|
||||||
{{^items.complexType}}
|
|
||||||
(e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>()
|
|
||||||
{{/items.complexType}}
|
|
||||||
).toList(growable: false);
|
|
||||||
{{/items.isArray}}
|
|
||||||
{{^items.isArray}}
|
|
||||||
{{{name}}} = {{{complexType}}}.listFromJson(json['{{{baseName}}}']);
|
|
||||||
{{/items.isArray}}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{#isMap}}
|
|
||||||
{{#items.isArray}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
{{#items.complexType}}
|
|
||||||
: {{items.complexType}}.mapListFromJson(json['{{{baseName}}}']);
|
|
||||||
{{/items.complexType}}
|
|
||||||
{{^items.complexType}}
|
|
||||||
: (json['{{{baseName}}}'] as Map).cast<String, List>();
|
|
||||||
{{/items.complexType}}
|
|
||||||
{{/items.isArray}}
|
|
||||||
{{^items.isArray}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
: {{{complexType}}}.mapFromJson(json['{{{baseName}}}']);
|
|
||||||
{{/items.isArray}}
|
|
||||||
{{/isMap}}
|
|
||||||
{{^isMap}}
|
|
||||||
{{{name}}} = {{{complexType}}}.fromJson(json['{{{baseName}}}']);
|
|
||||||
{{/isMap}}
|
|
||||||
{{/isArray}}
|
|
||||||
{{/complexType}}
|
|
||||||
{{^complexType}}
|
|
||||||
{{#isArray}}
|
|
||||||
{{#isEnum}}
|
|
||||||
{{{name}}} = {{{classname}}}{{{items.datatypeWithEnum}}}.listFromJson(json['{{{baseName}}}']);
|
|
||||||
{{/isEnum}}
|
|
||||||
{{^isEnum}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null
|
|
||||||
? null
|
|
||||||
: (json['{{{baseName}}}'] as List).cast<{{{items.datatype}}}>();
|
|
||||||
{{/isEnum}}
|
|
||||||
{{/isArray}}
|
|
||||||
{{^isArray}}
|
|
||||||
{{#isMap}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null ?
|
|
||||||
null :
|
|
||||||
(json['{{{baseName}}}'] as Map).cast<String, {{{items.datatype}}}>();
|
|
||||||
{{/isMap}}
|
|
||||||
{{^isMap}}
|
|
||||||
{{#isNumber}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'] == null ?
|
|
||||||
null :
|
|
||||||
json['{{{baseName}}}'].toDouble();
|
|
||||||
{{/isNumber}}
|
|
||||||
{{^isNumber}}
|
|
||||||
{{^isEnum}}
|
|
||||||
{{{name}}} = json['{{{baseName}}}'];
|
|
||||||
{{/isEnum}}
|
|
||||||
{{#isEnum}}
|
|
||||||
{{{name}}} = {{{classname}}}{{{enumName}}}.fromJson(json['{{{baseName}}}']);
|
|
||||||
{{/isEnum}}
|
|
||||||
{{/isNumber}}
|
|
||||||
{{/isMap}}
|
|
||||||
{{/isArray}}
|
|
||||||
{{/complexType}}
|
|
||||||
{{/isDate}}
|
|
||||||
{{/isDateTime}}
|
|
||||||
{{/vars}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#description}}/// {{{description}}}{{/description}}
|
{{#description}}/// {{{description}}}{{/description}}
|
||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
@ -149,7 +37,7 @@ class {{{classname}}} {
|
|||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#isNullable}}({{{name}}}?.hashCode ?? 0){{/isNullable}}{{^isNullable}}{{{name}}}.hashCode{{/isNullable}}{{^-last}} +{{/-last}}{{#-last}};{{/-last}}
|
({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -157,38 +45,150 @@ class {{{classname}}} {
|
|||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
if ({{{name}}} != null) {
|
if ({{{name}}} != null) {
|
||||||
{{#isDateTime}}
|
{{#isDateTime}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
json['{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
|
json['{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
|
||||||
? {{{name}}}.millisecondsSinceEpoch
|
? {{{name}}}.millisecondsSinceEpoch
|
||||||
: {{{name}}}.toUtc().toIso8601String();
|
: {{{name}}}.toUtc().toIso8601String();
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{^pattern}}
|
{{^pattern}}
|
||||||
json['{{{baseName}}}'] = {{{name}}}.toUtc().toIso8601String();
|
json['{{{baseName}}}'] = {{{name}}}.toUtc().toIso8601String();
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{/isDateTime}}
|
{{/isDateTime}}
|
||||||
{{#isDate}}
|
{{#isDate}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
json['{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
|
json['{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
|
||||||
? {{{name}}}.millisecondsSinceEpoch
|
? {{{name}}}.millisecondsSinceEpoch
|
||||||
: _dateFormatter.format({{{name}}}.toUtc());
|
: _dateFormatter.format({{{name}}}.toUtc());
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{^pattern}}
|
{{^pattern}}
|
||||||
json['{{{baseName}}}'] = _dateFormatter.format({{{name}}}.toUtc());
|
json['{{{baseName}}}'] = _dateFormatter.format({{{name}}}.toUtc());
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{/isDate}}
|
|
||||||
{{^isDateTime}}
|
|
||||||
{{^isDate}}
|
|
||||||
json['{{{baseName}}}'] = {{{name}}};
|
|
||||||
{{/isDate}}
|
{{/isDate}}
|
||||||
{{/isDateTime}}
|
{{^isDateTime}}
|
||||||
|
{{^isDate}}
|
||||||
|
json['{{{baseName}}}'] = {{{name}}};
|
||||||
|
{{/isDate}}
|
||||||
|
{{/isDateTime}}
|
||||||
}
|
}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [{{{classname}}}] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static {{{classname}}} fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: {{{classname}}}(
|
||||||
|
{{#vars}}
|
||||||
|
{{#isDateTime}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
{{#pattern}}
|
||||||
|
: _dateEpochMarker == '{{{pattern}}}'
|
||||||
|
? DateTime.fromMillisecondsSinceEpoch(json['{{{baseName}}}'] as int, isUtc: true)
|
||||||
|
: DateTime.parse(json['{{{baseName}}}']),
|
||||||
|
{{/pattern}}
|
||||||
|
{{^pattern}}
|
||||||
|
: DateTime.parse(json['{{{baseName}}}']),
|
||||||
|
{{/pattern}}
|
||||||
|
{{/isDateTime}}
|
||||||
|
{{#isDate}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
{{#pattern}}
|
||||||
|
: _dateEpochMarker == '{{{pattern}}}'
|
||||||
|
? DateTime.fromMillisecondsSinceEpoch(json['{{{baseName}}}'] as int, isUtc: true)
|
||||||
|
: DateTime.parse(json['{{{baseName}}}']),
|
||||||
|
{{/pattern}}
|
||||||
|
{{^pattern}}
|
||||||
|
: DateTime.parse(json['{{{baseName}}}']),
|
||||||
|
{{/pattern}}
|
||||||
|
{{/isDate}}
|
||||||
|
{{^isDateTime}}
|
||||||
|
{{^isDate}}
|
||||||
|
{{#complexType}}
|
||||||
|
{{#isArray}}
|
||||||
|
{{#items.isArray}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
: (json['{{{baseName}}}'] as List).map(
|
||||||
|
{{#items.complexType}}
|
||||||
|
{{items.complexType}}.listFromJson(json['{{{baseName}}}'])
|
||||||
|
{{/items.complexType}}
|
||||||
|
{{^items.complexType}}
|
||||||
|
(e) => e == null ? null : (e as List).cast<{{items.items.dataType}}>()
|
||||||
|
{{/items.complexType}}
|
||||||
|
).toList(growable: false),
|
||||||
|
{{/items.isArray}}
|
||||||
|
{{^items.isArray}}
|
||||||
|
{{{name}}}: {{{complexType}}}.listFromJson(json['{{{baseName}}}']),
|
||||||
|
{{/items.isArray}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{^isArray}}
|
||||||
|
{{#isMap}}
|
||||||
|
{{#items.isArray}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
{{#items.complexType}}
|
||||||
|
: {{items.complexType}}.mapListFromJson(json['{{{baseName}}}']),
|
||||||
|
{{/items.complexType}}
|
||||||
|
{{^items.complexType}}
|
||||||
|
: (json['{{{baseName}}}'] as Map).cast<String, List>(),
|
||||||
|
{{/items.complexType}}
|
||||||
|
{{/items.isArray}}
|
||||||
|
{{^items.isArray}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
: {{{complexType}}}.mapFromJson(json['{{{baseName}}}']),
|
||||||
|
{{/items.isArray}}
|
||||||
|
{{/isMap}}
|
||||||
|
{{^isMap}}
|
||||||
|
{{{name}}}: {{{complexType}}}.fromJson(json['{{{baseName}}}']),
|
||||||
|
{{/isMap}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{/complexType}}
|
||||||
|
{{^complexType}}
|
||||||
|
{{#isArray}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{{name}}}: {{{classname}}}{{{items.datatypeWithEnum}}}.listFromJson(json['{{{baseName}}}']),
|
||||||
|
{{/isEnum}}
|
||||||
|
{{^isEnum}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null
|
||||||
|
? null
|
||||||
|
: (json['{{{baseName}}}'] as List).cast<{{{items.datatype}}}>(),
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{^isArray}}
|
||||||
|
{{#isMap}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null ?
|
||||||
|
null :
|
||||||
|
(json['{{{baseName}}}'] as Map).cast<String, {{{items.datatype}}}>(),
|
||||||
|
{{/isMap}}
|
||||||
|
{{^isMap}}
|
||||||
|
{{#isNumber}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'] == null ?
|
||||||
|
null :
|
||||||
|
json['{{{baseName}}}'].toDouble(),
|
||||||
|
{{/isNumber}}
|
||||||
|
{{^isNumber}}
|
||||||
|
{{^isEnum}}
|
||||||
|
{{{name}}}: json['{{{baseName}}}'],
|
||||||
|
{{/isEnum}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{{name}}}: {{{classname}}}{{{enumName}}}.fromJson(json['{{{baseName}}}']),
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/isNumber}}
|
||||||
|
{{/isMap}}
|
||||||
|
{{/isArray}}
|
||||||
|
{{/complexType}}
|
||||||
|
{{/isDate}}
|
||||||
|
{{/isDateTime}}
|
||||||
|
{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <{{{classname}}}>[]
|
? true == emptyIsNull ? null : <{{{classname}}}>[]
|
||||||
|
@ -39,7 +39,7 @@ class {{{classname}}} {
|
|||||||
{{/allowableValues}}
|
{{/allowableValues}}
|
||||||
];
|
];
|
||||||
|
|
||||||
static {{{classname}}} fromJson({{{dataType}}} value) =>
|
static {{{classname}}} fromJson(dynamic value) =>
|
||||||
{{{classname}}}TypeTransformer().decode(value);
|
{{{classname}}}TypeTransformer().decode(value);
|
||||||
|
|
||||||
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<{{{classname}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
|
@ -39,7 +39,7 @@ class {{{classname}}}{{{enumName}}} {
|
|||||||
{{/allowableValues}}
|
{{/allowableValues}}
|
||||||
];
|
];
|
||||||
|
|
||||||
static {{{classname}}}{{{enumName}}} fromJson({{{dataType}}} value) =>
|
static {{{classname}}}{{{enumName}}} fromJson(dynamic value) =>
|
||||||
{{{classname}}}{{{enumName}}}TypeTransformer().decode(value);
|
{{{classname}}}{{{enumName}}}TypeTransformer().decode(value);
|
||||||
|
|
||||||
static List<{{{classname}}}{{{enumName}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<{{{classname}}}{{{enumName}}}> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
|
@ -37,7 +37,6 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>['application/json', 'application/xml'];
|
final contentTypes = <String>['application/json', 'application/xml'];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['petstore_auth'];
|
final authNames = <String>['petstore_auth'];
|
||||||
@ -104,7 +103,9 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
headerParams['api_key'] = apiKey;
|
if (apiKey != null) {
|
||||||
|
headerParams['api_key'] = parameterToString(apiKey);
|
||||||
|
}
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
@ -330,7 +331,6 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['api_key'];
|
final authNames = <String>['api_key'];
|
||||||
@ -403,7 +403,6 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>['application/json', 'application/xml'];
|
final contentTypes = <String>['application/json', 'application/xml'];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['petstore_auth'];
|
final authNames = <String>['petstore_auth'];
|
||||||
@ -474,7 +473,6 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
final contentTypes = <String>['application/x-www-form-urlencoded'];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['petstore_auth'];
|
final authNames = <String>['petstore_auth'];
|
||||||
@ -565,7 +563,6 @@ class PetApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>['multipart/form-data'];
|
final contentTypes = <String>['multipart/form-data'];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['petstore_auth'];
|
final authNames = <String>['petstore_auth'];
|
||||||
|
@ -40,7 +40,6 @@ class StoreApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -98,7 +97,6 @@ class StoreApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>['api_key'];
|
final authNames = <String>['api_key'];
|
||||||
@ -169,7 +167,6 @@ class StoreApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -242,7 +239,6 @@ class StoreApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
|
@ -39,7 +39,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -105,7 +104,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -169,7 +167,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -236,7 +233,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -303,7 +299,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -446,7 +441,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
@ -514,7 +508,6 @@ class UserApi {
|
|||||||
final headerParams = <String, String>{};
|
final headerParams = <String, String>{};
|
||||||
final formParams = <String, String>{};
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
|
||||||
final contentTypes = <String>[];
|
final contentTypes = <String>[];
|
||||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
final authNames = <String>[];
|
final authNames = <String>[];
|
||||||
|
@ -17,16 +17,6 @@ class ApiResponse {
|
|||||||
this.message,
|
this.message,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [ApiResponse] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
code = json['code'];
|
|
||||||
type = json['type'];
|
|
||||||
message = json['message'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
@ -44,9 +34,9 @@ class ApiResponse {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
code.hashCode +
|
(code == null ? 0 : code.hashCode) +
|
||||||
type.hashCode +
|
(type == null ? 0 : type.hashCode) +
|
||||||
message.hashCode;
|
(message == null ? 0 : message.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'ApiResponse[code=$code, type=$type, message=$message]';
|
String toString() => 'ApiResponse[code=$code, type=$type, message=$message]';
|
||||||
@ -65,6 +55,16 @@ class ApiResponse {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [ApiResponse] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static ApiResponse fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: ApiResponse(
|
||||||
|
code: json['code'],
|
||||||
|
type: json['type'],
|
||||||
|
message: json['message'],
|
||||||
|
);
|
||||||
|
|
||||||
static List<ApiResponse> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<ApiResponse> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <ApiResponse>[]
|
? true == emptyIsNull ? null : <ApiResponse>[]
|
||||||
|
@ -16,15 +16,6 @@ class Category {
|
|||||||
this.name,
|
this.name,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [Category] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
Category.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
@ -38,8 +29,8 @@ class Category {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode +
|
(id == null ? 0 : id.hashCode) +
|
||||||
name.hashCode;
|
(name == null ? 0 : name.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Category[id=$id, name=$name]';
|
String toString() => 'Category[id=$id, name=$name]';
|
||||||
@ -55,6 +46,15 @@ class Category {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [Category] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static Category fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: Category(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
);
|
||||||
|
|
||||||
static List<Category> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<Category> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <Category>[]
|
? true == emptyIsNull ? null : <Category>[]
|
||||||
|
@ -20,21 +20,6 @@ class Order {
|
|||||||
this.complete = false,
|
this.complete = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [Order] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
Order.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
id = json['id'];
|
|
||||||
petId = json['petId'];
|
|
||||||
quantity = json['quantity'];
|
|
||||||
shipDate = json['shipDate'] == null
|
|
||||||
? null
|
|
||||||
: DateTime.parse(json['shipDate']);
|
|
||||||
status = OrderStatusEnum.fromJson(json['status']);
|
|
||||||
complete = json['complete'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
@ -64,12 +49,12 @@ class Order {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode +
|
(id == null ? 0 : id.hashCode) +
|
||||||
petId.hashCode +
|
(petId == null ? 0 : petId.hashCode) +
|
||||||
quantity.hashCode +
|
(quantity == null ? 0 : quantity.hashCode) +
|
||||||
shipDate.hashCode +
|
(shipDate == null ? 0 : shipDate.hashCode) +
|
||||||
status.hashCode +
|
(status == null ? 0 : status.hashCode) +
|
||||||
complete.hashCode;
|
(complete == null ? 0 : complete.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]';
|
String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]';
|
||||||
@ -97,6 +82,21 @@ class Order {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [Order] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static Order fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: Order(
|
||||||
|
id: json['id'],
|
||||||
|
petId: json['petId'],
|
||||||
|
quantity: json['quantity'],
|
||||||
|
shipDate: json['shipDate'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['shipDate']),
|
||||||
|
status: OrderStatusEnum.fromJson(json['status']),
|
||||||
|
complete: json['complete'],
|
||||||
|
);
|
||||||
|
|
||||||
static List<Order> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<Order> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <Order>[]
|
? true == emptyIsNull ? null : <Order>[]
|
||||||
@ -154,7 +154,7 @@ class OrderStatusEnum {
|
|||||||
delivered_,
|
delivered_,
|
||||||
];
|
];
|
||||||
|
|
||||||
static OrderStatusEnum fromJson(String value) =>
|
static OrderStatusEnum fromJson(dynamic value) =>
|
||||||
OrderStatusEnumTypeTransformer().decode(value);
|
OrderStatusEnumTypeTransformer().decode(value);
|
||||||
|
|
||||||
static List<OrderStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<OrderStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
|
@ -20,21 +20,6 @@ class Pet {
|
|||||||
this.status,
|
this.status,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [Pet] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
Pet.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
id = json['id'];
|
|
||||||
category = Category.fromJson(json['category']);
|
|
||||||
name = json['name'];
|
|
||||||
photoUrls = json['photoUrls'] == null
|
|
||||||
? null
|
|
||||||
: (json['photoUrls'] as List).cast<String>();
|
|
||||||
tags = Tag.listFromJson(json['tags']);
|
|
||||||
status = PetStatusEnum.fromJson(json['status']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
@ -64,12 +49,12 @@ class Pet {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode +
|
(id == null ? 0 : id.hashCode) +
|
||||||
category.hashCode +
|
(category == null ? 0 : category.hashCode) +
|
||||||
name.hashCode +
|
(name == null ? 0 : name.hashCode) +
|
||||||
photoUrls.hashCode +
|
(photoUrls == null ? 0 : photoUrls.hashCode) +
|
||||||
tags.hashCode +
|
(tags == null ? 0 : tags.hashCode) +
|
||||||
status.hashCode;
|
(status == null ? 0 : status.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]';
|
String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]';
|
||||||
@ -97,6 +82,21 @@ class Pet {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [Pet] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static Pet fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: Pet(
|
||||||
|
id: json['id'],
|
||||||
|
category: Category.fromJson(json['category']),
|
||||||
|
name: json['name'],
|
||||||
|
photoUrls: json['photoUrls'] == null
|
||||||
|
? null
|
||||||
|
: (json['photoUrls'] as List).cast<String>(),
|
||||||
|
tags: Tag.listFromJson(json['tags']),
|
||||||
|
status: PetStatusEnum.fromJson(json['status']),
|
||||||
|
);
|
||||||
|
|
||||||
static List<Pet> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<Pet> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <Pet>[]
|
? true == emptyIsNull ? null : <Pet>[]
|
||||||
@ -154,7 +154,7 @@ class PetStatusEnum {
|
|||||||
sold_,
|
sold_,
|
||||||
];
|
];
|
||||||
|
|
||||||
static PetStatusEnum fromJson(String value) =>
|
static PetStatusEnum fromJson(dynamic value) =>
|
||||||
PetStatusEnumTypeTransformer().decode(value);
|
PetStatusEnumTypeTransformer().decode(value);
|
||||||
|
|
||||||
static List<PetStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<PetStatusEnum> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
|
@ -16,15 +16,6 @@ class Tag {
|
|||||||
this.name,
|
this.name,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [Tag] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
Tag.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
id = json['id'];
|
|
||||||
name = json['name'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
@ -38,8 +29,8 @@ class Tag {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode +
|
(id == null ? 0 : id.hashCode) +
|
||||||
name.hashCode;
|
(name == null ? 0 : name.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'Tag[id=$id, name=$name]';
|
String toString() => 'Tag[id=$id, name=$name]';
|
||||||
@ -55,6 +46,15 @@ class Tag {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [Tag] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static Tag fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: Tag(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
);
|
||||||
|
|
||||||
static List<Tag> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<Tag> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <Tag>[]
|
? true == emptyIsNull ? null : <Tag>[]
|
||||||
|
@ -22,21 +22,6 @@ class User {
|
|||||||
this.userStatus,
|
this.userStatus,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Returns a new [User] instance and optionally import its values from
|
|
||||||
/// [json] if it's non-null.
|
|
||||||
User.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json != null) {
|
|
||||||
id = json['id'];
|
|
||||||
username = json['username'];
|
|
||||||
firstName = json['firstName'];
|
|
||||||
lastName = json['lastName'];
|
|
||||||
email = json['email'];
|
|
||||||
password = json['password'];
|
|
||||||
phone = json['phone'];
|
|
||||||
userStatus = json['userStatus'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
@ -74,14 +59,14 @@ class User {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
id.hashCode +
|
(id == null ? 0 : id.hashCode) +
|
||||||
username.hashCode +
|
(username == null ? 0 : username.hashCode) +
|
||||||
firstName.hashCode +
|
(firstName == null ? 0 : firstName.hashCode) +
|
||||||
lastName.hashCode +
|
(lastName == null ? 0 : lastName.hashCode) +
|
||||||
email.hashCode +
|
(email == null ? 0 : email.hashCode) +
|
||||||
password.hashCode +
|
(password == null ? 0 : password.hashCode) +
|
||||||
phone.hashCode +
|
(phone == null ? 0 : phone.hashCode) +
|
||||||
userStatus.hashCode;
|
(userStatus == null ? 0 : userStatus.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]';
|
String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]';
|
||||||
@ -115,6 +100,21 @@ class User {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new [User] instance and imports its values from
|
||||||
|
/// [json] if it's non-null, null if [json] is null.
|
||||||
|
static User fromJson(Map<String, dynamic> json) => json == null
|
||||||
|
? null
|
||||||
|
: User(
|
||||||
|
id: json['id'],
|
||||||
|
username: json['username'],
|
||||||
|
firstName: json['firstName'],
|
||||||
|
lastName: json['lastName'],
|
||||||
|
email: json['email'],
|
||||||
|
password: json['password'],
|
||||||
|
phone: json['phone'],
|
||||||
|
userStatus: json['userStatus'],
|
||||||
|
);
|
||||||
|
|
||||||
static List<User> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
static List<User> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||||
json == null || json.isEmpty
|
json == null || json.isEmpty
|
||||||
? true == emptyIsNull ? null : <User>[]
|
? true == emptyIsNull ? null : <User>[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user