fix: resolved type conversion

This commit is contained in:
Wlad Meixner 2023-11-05 21:14:39 +01:00
parent 4a3123aa74
commit 064ffcd2c1
19 changed files with 1530 additions and 1210 deletions

1217
README.md

File diff suppressed because it is too large Load Diff

View File

@ -30,22 +30,25 @@ class NotificationModelDetailsInner {
ValuesPropertyModelLinks links; ValuesPropertyModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is NotificationModelDetailsInner && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.property == property && other is NotificationModelDetailsInner &&
other.value == value && other.type == type &&
other.links == links; other.property == property &&
other.value == value &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(property == null ? 0 : property!.hashCode) + (property == null ? 0 : property!.hashCode) +
(value == null ? 0 : value!.hashCode) + (value == null ? 0 : value!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'NotificationModelDetailsInner[type=$type, property=$property, value=$value, links=$links]'; String toString() =>
'NotificationModelDetailsInner[type=$type, property=$property, value=$value, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -64,7 +67,7 @@ class NotificationModelDetailsInner {
} else { } else {
json[r'value'] = null; json[r'value'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -80,14 +83,16 @@ class NotificationModelDetailsInner {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "NotificationModelDetailsInner[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "NotificationModelDetailsInner[$key]" has a null value in JSON.'); 'Required key "NotificationModelDetailsInner[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "NotificationModelDetailsInner[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return NotificationModelDetailsInner( return NotificationModelDetailsInner(
type: Object.fromJson(json[r'_type']), type: NotificationModelDetailsInnerTypeEnum.fromJson(json[r'_type']),
property: mapValueOfType<Object>(json, r'property'), property: mapValueOfType<Object>(json, r'property'),
value: mapValueOfType<Object>(json, r'value'), value: mapValueOfType<Object>(json, r'value'),
links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!, links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!,
@ -96,7 +101,10 @@ class NotificationModelDetailsInner {
return null; return null;
} }
static List<NotificationModelDetailsInner> listFromJson(dynamic json, {bool growable = false,}) { static List<NotificationModelDetailsInner> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <NotificationModelDetailsInner>[]; final result = <NotificationModelDetailsInner>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -124,13 +132,19 @@ class NotificationModelDetailsInner {
} }
// maps a json object with a list of NotificationModelDetailsInner-objects as value to a dart map // maps a json object with a list of NotificationModelDetailsInner-objects as value to a dart map
static Map<String, List<NotificationModelDetailsInner>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<NotificationModelDetailsInner>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<NotificationModelDetailsInner>>{}; final map = <String, List<NotificationModelDetailsInner>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = NotificationModelDetailsInner.listFromJson(entry.value, growable: growable,); map[entry.key] = NotificationModelDetailsInner.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -145,7 +159,6 @@ class NotificationModelDetailsInner {
}; };
} }
class NotificationModelDetailsInnerTypeEnum { class NotificationModelDetailsInnerTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const NotificationModelDetailsInnerTypeEnum._(this.value); const NotificationModelDetailsInnerTypeEnum._(this.value);
@ -158,16 +171,21 @@ class NotificationModelDetailsInnerTypeEnum {
Object toJson() => value; Object toJson() => value;
static const valuesColonColonProperty = NotificationModelDetailsInnerTypeEnum._('Values::Property'); static const valuesColonColonProperty =
NotificationModelDetailsInnerTypeEnum._('Values::Property');
/// List of all possible values in this [enum][NotificationModelDetailsInnerTypeEnum]. /// List of all possible values in this [enum][NotificationModelDetailsInnerTypeEnum].
static const values = <NotificationModelDetailsInnerTypeEnum>[ static const values = <NotificationModelDetailsInnerTypeEnum>[
valuesColonColonProperty, valuesColonColonProperty,
]; ];
static NotificationModelDetailsInnerTypeEnum? fromJson(dynamic value) => NotificationModelDetailsInnerTypeEnumTypeTransformer().decode(value); static NotificationModelDetailsInnerTypeEnum? fromJson(dynamic value) =>
NotificationModelDetailsInnerTypeEnumTypeTransformer().decode(value);
static List<NotificationModelDetailsInnerTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<NotificationModelDetailsInnerTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <NotificationModelDetailsInnerTypeEnum>[]; final result = <NotificationModelDetailsInnerTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -184,7 +202,9 @@ class NotificationModelDetailsInnerTypeEnum {
/// Transformation class that can [encode] an instance of [NotificationModelDetailsInnerTypeEnum] to Object, /// Transformation class that can [encode] an instance of [NotificationModelDetailsInnerTypeEnum] to Object,
/// and [decode] dynamic data back to [NotificationModelDetailsInnerTypeEnum]. /// and [decode] dynamic data back to [NotificationModelDetailsInnerTypeEnum].
class NotificationModelDetailsInnerTypeEnumTypeTransformer { class NotificationModelDetailsInnerTypeEnumTypeTransformer {
factory NotificationModelDetailsInnerTypeEnumTypeTransformer() => _instance ??= const NotificationModelDetailsInnerTypeEnumTypeTransformer._(); factory NotificationModelDetailsInnerTypeEnumTypeTransformer() =>
_instance ??=
const NotificationModelDetailsInnerTypeEnumTypeTransformer._();
const NotificationModelDetailsInnerTypeEnumTypeTransformer._(); const NotificationModelDetailsInnerTypeEnumTypeTransformer._();
@ -198,10 +218,12 @@ class NotificationModelDetailsInnerTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
NotificationModelDetailsInnerTypeEnum? decode(dynamic data, {bool allowNull = true}) { NotificationModelDetailsInnerTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Values::Property': return NotificationModelDetailsInnerTypeEnum.valuesColonColonProperty; case 'Values::Property':
return NotificationModelDetailsInnerTypeEnum.valuesColonColonProperty;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -214,5 +236,3 @@ class NotificationModelDetailsInnerTypeEnumTypeTransformer {
/// Singleton [NotificationModelDetailsInnerTypeEnumTypeTransformer] instance. /// Singleton [NotificationModelDetailsInnerTypeEnumTypeTransformer] instance.
static NotificationModelDetailsInnerTypeEnumTypeTransformer? _instance; static NotificationModelDetailsInnerTypeEnumTypeTransformer? _instance;
} }

View File

@ -107,56 +107,59 @@ class NotificationModelEmbeddedResource {
WorkPackageModelLinks links; WorkPackageModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is NotificationModelEmbeddedResource && bool operator ==(Object other) =>
other.id == id && identical(this, other) ||
other.lockVersion == lockVersion && other is NotificationModelEmbeddedResource &&
other.subject == subject && other.id == id &&
other.type == type && other.lockVersion == lockVersion &&
other.description == description && other.subject == subject &&
other.scheduleManually == scheduleManually && other.type == type &&
other.readonly == readonly && other.description == description &&
other.startDate == startDate && other.scheduleManually == scheduleManually &&
other.dueDate == dueDate && other.readonly == readonly &&
other.date == date && other.startDate == startDate &&
other.derivedStartDate == derivedStartDate && other.dueDate == dueDate &&
other.derivedDueDate == derivedDueDate && other.date == date &&
other.duration == duration && other.derivedStartDate == derivedStartDate &&
other.estimatedTime == estimatedTime && other.derivedDueDate == derivedDueDate &&
other.derivedEstimatedTime == derivedEstimatedTime && other.duration == duration &&
other.ignoreNonWorkingDays == ignoreNonWorkingDays && other.estimatedTime == estimatedTime &&
other.spentTime == spentTime && other.derivedEstimatedTime == derivedEstimatedTime &&
other.percentageDone == percentageDone && other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
other.createdAt == createdAt && other.spentTime == spentTime &&
other.updatedAt == updatedAt && other.percentageDone == percentageDone &&
other.links == links; other.createdAt == createdAt &&
other.updatedAt == updatedAt &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(lockVersion == null ? 0 : lockVersion!.hashCode) + (lockVersion == null ? 0 : lockVersion!.hashCode) +
(subject == null ? 0 : subject!.hashCode) + (subject == null ? 0 : subject!.hashCode) +
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(description == null ? 0 : description!.hashCode) + (description == null ? 0 : description!.hashCode) +
(scheduleManually == null ? 0 : scheduleManually!.hashCode) + (scheduleManually == null ? 0 : scheduleManually!.hashCode) +
(readonly == null ? 0 : readonly!.hashCode) + (readonly == null ? 0 : readonly!.hashCode) +
(startDate == null ? 0 : startDate!.hashCode) + (startDate == null ? 0 : startDate!.hashCode) +
(dueDate == null ? 0 : dueDate!.hashCode) + (dueDate == null ? 0 : dueDate!.hashCode) +
(date == null ? 0 : date!.hashCode) + (date == null ? 0 : date!.hashCode) +
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) + (derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) + (derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
(duration == null ? 0 : duration!.hashCode) + (duration == null ? 0 : duration!.hashCode) +
(estimatedTime == null ? 0 : estimatedTime!.hashCode) + (estimatedTime == null ? 0 : estimatedTime!.hashCode) +
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) + (derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) + (ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
(spentTime == null ? 0 : spentTime!.hashCode) + (spentTime == null ? 0 : spentTime!.hashCode) +
(percentageDone == null ? 0 : percentageDone!.hashCode) + (percentageDone == null ? 0 : percentageDone!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(updatedAt == null ? 0 : updatedAt!.hashCode) + (updatedAt == null ? 0 : updatedAt!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'NotificationModelEmbeddedResource[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]'; String toString() =>
'NotificationModelEmbeddedResource[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -260,7 +263,7 @@ class NotificationModelEmbeddedResource {
} else { } else {
json[r'updatedAt'] = null; json[r'updatedAt'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -276,8 +279,10 @@ class NotificationModelEmbeddedResource {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "NotificationModelEmbeddedResource[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "NotificationModelEmbeddedResource[$key]" has a null value in JSON.'); 'Required key "NotificationModelEmbeddedResource[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "NotificationModelEmbeddedResource[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
@ -286,7 +291,8 @@ class NotificationModelEmbeddedResource {
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
lockVersion: mapValueOfType<Object>(json, r'lockVersion'), lockVersion: mapValueOfType<Object>(json, r'lockVersion'),
subject: mapValueOfType<Object>(json, r'subject'), subject: mapValueOfType<Object>(json, r'subject'),
type: Object.fromJson(json[r'_type']), type:
NotificationModelEmbeddedResourceTypeEnum.fromJson(json[r'_type']),
description: WorkPackageModelDescription.fromJson(json[r'description']), description: WorkPackageModelDescription.fromJson(json[r'description']),
scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'), scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'),
readonly: mapValueOfType<Object>(json, r'readonly'), readonly: mapValueOfType<Object>(json, r'readonly'),
@ -297,8 +303,10 @@ class NotificationModelEmbeddedResource {
derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'), derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'),
duration: mapValueOfType<Object>(json, r'duration'), duration: mapValueOfType<Object>(json, r'duration'),
estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'), estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'),
derivedEstimatedTime: mapValueOfType<Object>(json, r'derivedEstimatedTime'), derivedEstimatedTime:
ignoreNonWorkingDays: mapValueOfType<Object>(json, r'ignoreNonWorkingDays'), mapValueOfType<Object>(json, r'derivedEstimatedTime'),
ignoreNonWorkingDays:
mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
spentTime: mapValueOfType<Object>(json, r'spentTime'), spentTime: mapValueOfType<Object>(json, r'spentTime'),
percentageDone: mapValueOfType<Object>(json, r'percentageDone'), percentageDone: mapValueOfType<Object>(json, r'percentageDone'),
createdAt: mapValueOfType<Object>(json, r'createdAt'), createdAt: mapValueOfType<Object>(json, r'createdAt'),
@ -309,7 +317,10 @@ class NotificationModelEmbeddedResource {
return null; return null;
} }
static List<NotificationModelEmbeddedResource> listFromJson(dynamic json, {bool growable = false,}) { static List<NotificationModelEmbeddedResource> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <NotificationModelEmbeddedResource>[]; final result = <NotificationModelEmbeddedResource>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -322,7 +333,8 @@ class NotificationModelEmbeddedResource {
return result.toList(growable: growable); return result.toList(growable: growable);
} }
static Map<String, NotificationModelEmbeddedResource> mapFromJson(dynamic json) { static Map<String, NotificationModelEmbeddedResource> mapFromJson(
dynamic json) {
final map = <String, NotificationModelEmbeddedResource>{}; final map = <String, NotificationModelEmbeddedResource>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments json = json.cast<String, dynamic>(); // ignore: parameter_assignments
@ -337,13 +349,19 @@ class NotificationModelEmbeddedResource {
} }
// maps a json object with a list of NotificationModelEmbeddedResource-objects as value to a dart map // maps a json object with a list of NotificationModelEmbeddedResource-objects as value to a dart map
static Map<String, List<NotificationModelEmbeddedResource>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<NotificationModelEmbeddedResource>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<NotificationModelEmbeddedResource>>{}; final map = <String, List<NotificationModelEmbeddedResource>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = NotificationModelEmbeddedResource.listFromJson(entry.value, growable: growable,); map[entry.key] = NotificationModelEmbeddedResource.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -356,7 +374,6 @@ class NotificationModelEmbeddedResource {
}; };
} }
class NotificationModelEmbeddedResourceTypeEnum { class NotificationModelEmbeddedResourceTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const NotificationModelEmbeddedResourceTypeEnum._(this.value); const NotificationModelEmbeddedResourceTypeEnum._(this.value);
@ -369,16 +386,21 @@ class NotificationModelEmbeddedResourceTypeEnum {
Object toJson() => value; Object toJson() => value;
static const workPackage = NotificationModelEmbeddedResourceTypeEnum._('WorkPackage'); static const workPackage =
NotificationModelEmbeddedResourceTypeEnum._('WorkPackage');
/// List of all possible values in this [enum][NotificationModelEmbeddedResourceTypeEnum]. /// List of all possible values in this [enum][NotificationModelEmbeddedResourceTypeEnum].
static const values = <NotificationModelEmbeddedResourceTypeEnum>[ static const values = <NotificationModelEmbeddedResourceTypeEnum>[
workPackage, workPackage,
]; ];
static NotificationModelEmbeddedResourceTypeEnum? fromJson(dynamic value) => NotificationModelEmbeddedResourceTypeEnumTypeTransformer().decode(value); static NotificationModelEmbeddedResourceTypeEnum? fromJson(dynamic value) =>
NotificationModelEmbeddedResourceTypeEnumTypeTransformer().decode(value);
static List<NotificationModelEmbeddedResourceTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<NotificationModelEmbeddedResourceTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <NotificationModelEmbeddedResourceTypeEnum>[]; final result = <NotificationModelEmbeddedResourceTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -395,7 +417,9 @@ class NotificationModelEmbeddedResourceTypeEnum {
/// Transformation class that can [encode] an instance of [NotificationModelEmbeddedResourceTypeEnum] to Object, /// Transformation class that can [encode] an instance of [NotificationModelEmbeddedResourceTypeEnum] to Object,
/// and [decode] dynamic data back to [NotificationModelEmbeddedResourceTypeEnum]. /// and [decode] dynamic data back to [NotificationModelEmbeddedResourceTypeEnum].
class NotificationModelEmbeddedResourceTypeEnumTypeTransformer { class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
factory NotificationModelEmbeddedResourceTypeEnumTypeTransformer() => _instance ??= const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._(); factory NotificationModelEmbeddedResourceTypeEnumTypeTransformer() =>
_instance ??=
const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._();
const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._(); const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._();
@ -409,10 +433,12 @@ class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
NotificationModelEmbeddedResourceTypeEnum? decode(dynamic data, {bool allowNull = true}) { NotificationModelEmbeddedResourceTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'WorkPackage': return NotificationModelEmbeddedResourceTypeEnum.workPackage; case 'WorkPackage':
return NotificationModelEmbeddedResourceTypeEnum.workPackage;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -425,5 +451,3 @@ class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
/// Singleton [NotificationModelEmbeddedResourceTypeEnumTypeTransformer] instance. /// Singleton [NotificationModelEmbeddedResourceTypeEnumTypeTransformer] instance.
static NotificationModelEmbeddedResourceTypeEnumTypeTransformer? _instance; static NotificationModelEmbeddedResourceTypeEnumTypeTransformer? _instance;
} }

View File

@ -38,22 +38,25 @@ class RoleModel {
RoleModelLinks? links; RoleModelLinks? links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is RoleModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.id == id && other is RoleModel &&
other.name == name && other.type == type &&
other.links == links; other.id == id &&
other.name == name &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(links == null ? 0 : links!.hashCode); (links == null ? 0 : links!.hashCode);
@override @override
String toString() => 'RoleModel[type=$type, id=$id, name=$name, links=$links]'; String toString() =>
'RoleModel[type=$type, id=$id, name=$name, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -92,14 +95,16 @@ class RoleModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "RoleModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "RoleModel[$key]" has a null value in JSON.'); 'Required key "RoleModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "RoleModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return RoleModel( return RoleModel(
type: Object.fromJson(json[r'_type']), type: RoleModelTypeEnum.fromJson(json[r'_type']),
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
name: mapValueOfType<Object>(json, r'name'), name: mapValueOfType<Object>(json, r'name'),
links: RoleModelLinks.fromJson(json[r'_links']), links: RoleModelLinks.fromJson(json[r'_links']),
@ -108,7 +113,10 @@ class RoleModel {
return null; return null;
} }
static List<RoleModel> listFromJson(dynamic json, {bool growable = false,}) { static List<RoleModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <RoleModel>[]; final result = <RoleModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -136,13 +144,19 @@ class RoleModel {
} }
// maps a json object with a list of RoleModel-objects as value to a dart map // maps a json object with a list of RoleModel-objects as value to a dart map
static Map<String, List<RoleModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<RoleModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<RoleModel>>{}; final map = <String, List<RoleModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = RoleModel.listFromJson(entry.value, growable: growable,); map[entry.key] = RoleModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -154,7 +168,6 @@ class RoleModel {
}; };
} }
class RoleModelTypeEnum { class RoleModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const RoleModelTypeEnum._(this.value); const RoleModelTypeEnum._(this.value);
@ -174,9 +187,13 @@ class RoleModelTypeEnum {
role, role,
]; ];
static RoleModelTypeEnum? fromJson(dynamic value) => RoleModelTypeEnumTypeTransformer().decode(value); static RoleModelTypeEnum? fromJson(dynamic value) =>
RoleModelTypeEnumTypeTransformer().decode(value);
static List<RoleModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<RoleModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <RoleModelTypeEnum>[]; final result = <RoleModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -193,7 +210,8 @@ class RoleModelTypeEnum {
/// Transformation class that can [encode] an instance of [RoleModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [RoleModelTypeEnum] to Object,
/// and [decode] dynamic data back to [RoleModelTypeEnum]. /// and [decode] dynamic data back to [RoleModelTypeEnum].
class RoleModelTypeEnumTypeTransformer { class RoleModelTypeEnumTypeTransformer {
factory RoleModelTypeEnumTypeTransformer() => _instance ??= const RoleModelTypeEnumTypeTransformer._(); factory RoleModelTypeEnumTypeTransformer() =>
_instance ??= const RoleModelTypeEnumTypeTransformer._();
const RoleModelTypeEnumTypeTransformer._(); const RoleModelTypeEnumTypeTransformer._();
@ -210,7 +228,8 @@ class RoleModelTypeEnumTypeTransformer {
RoleModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { RoleModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Role': return RoleModelTypeEnum.role; case 'Role':
return RoleModelTypeEnum.role;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -223,5 +242,3 @@ class RoleModelTypeEnumTypeTransformer {
/// Singleton [RoleModelTypeEnumTypeTransformer] instance. /// Singleton [RoleModelTypeEnumTypeTransformer] instance.
static RoleModelTypeEnumTypeTransformer? _instance; static RoleModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -30,22 +30,25 @@ class RootModel {
RootModelLinks links; RootModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is RootModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.instanceName == instanceName && other is RootModel &&
other.coreVersion == coreVersion && other.type == type &&
other.links == links; other.instanceName == instanceName &&
other.coreVersion == coreVersion &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(instanceName == null ? 0 : instanceName!.hashCode) + (instanceName == null ? 0 : instanceName!.hashCode) +
(coreVersion == null ? 0 : coreVersion!.hashCode) + (coreVersion == null ? 0 : coreVersion!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'RootModel[type=$type, instanceName=$instanceName, coreVersion=$coreVersion, links=$links]'; String toString() =>
'RootModel[type=$type, instanceName=$instanceName, coreVersion=$coreVersion, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -64,7 +67,7 @@ class RootModel {
} else { } else {
json[r'coreVersion'] = null; json[r'coreVersion'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -80,14 +83,16 @@ class RootModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "RootModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "RootModel[$key]" has a null value in JSON.'); 'Required key "RootModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "RootModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return RootModel( return RootModel(
type: Object.fromJson(json[r'_type']), type: RootModelTypeEnum.fromJson(json[r'_type']),
instanceName: mapValueOfType<Object>(json, r'instanceName'), instanceName: mapValueOfType<Object>(json, r'instanceName'),
coreVersion: mapValueOfType<Object>(json, r'coreVersion'), coreVersion: mapValueOfType<Object>(json, r'coreVersion'),
links: RootModelLinks.fromJson(json[r'_links'])!, links: RootModelLinks.fromJson(json[r'_links'])!,
@ -96,7 +101,10 @@ class RootModel {
return null; return null;
} }
static List<RootModel> listFromJson(dynamic json, {bool growable = false,}) { static List<RootModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <RootModel>[]; final result = <RootModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -124,13 +132,19 @@ class RootModel {
} }
// maps a json object with a list of RootModel-objects as value to a dart map // maps a json object with a list of RootModel-objects as value to a dart map
static Map<String, List<RootModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<RootModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<RootModel>>{}; final map = <String, List<RootModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = RootModel.listFromJson(entry.value, growable: growable,); map[entry.key] = RootModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -144,7 +158,6 @@ class RootModel {
}; };
} }
class RootModelTypeEnum { class RootModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const RootModelTypeEnum._(this.value); const RootModelTypeEnum._(this.value);
@ -164,9 +177,13 @@ class RootModelTypeEnum {
root, root,
]; ];
static RootModelTypeEnum? fromJson(dynamic value) => RootModelTypeEnumTypeTransformer().decode(value); static RootModelTypeEnum? fromJson(dynamic value) =>
RootModelTypeEnumTypeTransformer().decode(value);
static List<RootModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<RootModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <RootModelTypeEnum>[]; final result = <RootModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -183,7 +200,8 @@ class RootModelTypeEnum {
/// Transformation class that can [encode] an instance of [RootModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [RootModelTypeEnum] to Object,
/// and [decode] dynamic data back to [RootModelTypeEnum]. /// and [decode] dynamic data back to [RootModelTypeEnum].
class RootModelTypeEnumTypeTransformer { class RootModelTypeEnumTypeTransformer {
factory RootModelTypeEnumTypeTransformer() => _instance ??= const RootModelTypeEnumTypeTransformer._(); factory RootModelTypeEnumTypeTransformer() =>
_instance ??= const RootModelTypeEnumTypeTransformer._();
const RootModelTypeEnumTypeTransformer._(); const RootModelTypeEnumTypeTransformer._();
@ -200,7 +218,8 @@ class RootModelTypeEnumTypeTransformer {
RootModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { RootModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Root': return RootModelTypeEnum.root; case 'Root':
return RootModelTypeEnum.root;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -213,5 +232,3 @@ class RootModelTypeEnumTypeTransformer {
/// Singleton [RootModelTypeEnumTypeTransformer] instance. /// Singleton [RootModelTypeEnumTypeTransformer] instance.
static RootModelTypeEnumTypeTransformer? _instance; static RootModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -26,20 +26,23 @@ class SchemaModel {
SchemaModelLinks links; SchemaModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is SchemaModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.dependencies == dependencies && other is SchemaModel &&
other.links == links; other.type == type &&
other.dependencies == dependencies &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(dependencies == null ? 0 : dependencies!.hashCode) + (dependencies == null ? 0 : dependencies!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'SchemaModel[type=$type, dependencies=$dependencies, links=$links]'; String toString() =>
'SchemaModel[type=$type, dependencies=$dependencies, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -53,7 +56,7 @@ class SchemaModel {
} else { } else {
json[r'_dependencies'] = null; json[r'_dependencies'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -69,14 +72,16 @@ class SchemaModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "SchemaModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "SchemaModel[$key]" has a null value in JSON.'); 'Required key "SchemaModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "SchemaModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return SchemaModel( return SchemaModel(
type: Object.fromJson(json[r'_type']), type: SchemaModelTypeEnum.fromJson(json[r'_type']),
dependencies: mapValueOfType<Object>(json, r'_dependencies'), dependencies: mapValueOfType<Object>(json, r'_dependencies'),
links: SchemaModelLinks.fromJson(json[r'_links'])!, links: SchemaModelLinks.fromJson(json[r'_links'])!,
); );
@ -84,7 +89,10 @@ class SchemaModel {
return null; return null;
} }
static List<SchemaModel> listFromJson(dynamic json, {bool growable = false,}) { static List<SchemaModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <SchemaModel>[]; final result = <SchemaModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -112,13 +120,19 @@ class SchemaModel {
} }
// maps a json object with a list of SchemaModel-objects as value to a dart map // maps a json object with a list of SchemaModel-objects as value to a dart map
static Map<String, List<SchemaModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<SchemaModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<SchemaModel>>{}; final map = <String, List<SchemaModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = SchemaModel.listFromJson(entry.value, growable: growable,); map[entry.key] = SchemaModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -131,7 +145,6 @@ class SchemaModel {
}; };
} }
class SchemaModelTypeEnum { class SchemaModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const SchemaModelTypeEnum._(this.value); const SchemaModelTypeEnum._(this.value);
@ -151,9 +164,13 @@ class SchemaModelTypeEnum {
schema, schema,
]; ];
static SchemaModelTypeEnum? fromJson(dynamic value) => SchemaModelTypeEnumTypeTransformer().decode(value); static SchemaModelTypeEnum? fromJson(dynamic value) =>
SchemaModelTypeEnumTypeTransformer().decode(value);
static List<SchemaModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<SchemaModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <SchemaModelTypeEnum>[]; final result = <SchemaModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -170,7 +187,8 @@ class SchemaModelTypeEnum {
/// Transformation class that can [encode] an instance of [SchemaModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [SchemaModelTypeEnum] to Object,
/// and [decode] dynamic data back to [SchemaModelTypeEnum]. /// and [decode] dynamic data back to [SchemaModelTypeEnum].
class SchemaModelTypeEnumTypeTransformer { class SchemaModelTypeEnumTypeTransformer {
factory SchemaModelTypeEnumTypeTransformer() => _instance ??= const SchemaModelTypeEnumTypeTransformer._(); factory SchemaModelTypeEnumTypeTransformer() =>
_instance ??= const SchemaModelTypeEnumTypeTransformer._();
const SchemaModelTypeEnumTypeTransformer._(); const SchemaModelTypeEnumTypeTransformer._();
@ -187,7 +205,8 @@ class SchemaModelTypeEnumTypeTransformer {
SchemaModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { SchemaModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Schema': return SchemaModelTypeEnum.schema; case 'Schema':
return SchemaModelTypeEnum.schema;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -200,5 +219,3 @@ class SchemaModelTypeEnumTypeTransformer {
/// Singleton [SchemaModelTypeEnumTypeTransformer] instance. /// Singleton [SchemaModelTypeEnumTypeTransformer] instance.
static SchemaModelTypeEnumTypeTransformer? _instance; static SchemaModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -59,32 +59,35 @@ class StatusModel {
StatusModelLinks? links; StatusModelLinks? links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StatusModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.id == id && other is StatusModel &&
other.name == name && other.type == type &&
other.position == position && other.id == id &&
other.isDefault == isDefault && other.name == name &&
other.isClosed == isClosed && other.position == position &&
other.isReadonly == isReadonly && other.isDefault == isDefault &&
other.defaultDoneRatio == defaultDoneRatio && other.isClosed == isClosed &&
other.links == links; other.isReadonly == isReadonly &&
other.defaultDoneRatio == defaultDoneRatio &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(position == null ? 0 : position!.hashCode) + (position == null ? 0 : position!.hashCode) +
(isDefault == null ? 0 : isDefault!.hashCode) + (isDefault == null ? 0 : isDefault!.hashCode) +
(isClosed == null ? 0 : isClosed!.hashCode) + (isClosed == null ? 0 : isClosed!.hashCode) +
(isReadonly == null ? 0 : isReadonly!.hashCode) + (isReadonly == null ? 0 : isReadonly!.hashCode) +
(defaultDoneRatio == null ? 0 : defaultDoneRatio!.hashCode) + (defaultDoneRatio == null ? 0 : defaultDoneRatio!.hashCode) +
(links == null ? 0 : links!.hashCode); (links == null ? 0 : links!.hashCode);
@override @override
String toString() => 'StatusModel[type=$type, id=$id, name=$name, position=$position, isDefault=$isDefault, isClosed=$isClosed, isReadonly=$isReadonly, defaultDoneRatio=$defaultDoneRatio, links=$links]'; String toString() =>
'StatusModel[type=$type, id=$id, name=$name, position=$position, isDefault=$isDefault, isClosed=$isClosed, isReadonly=$isReadonly, defaultDoneRatio=$defaultDoneRatio, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -148,14 +151,16 @@ class StatusModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StatusModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StatusModel[$key]" has a null value in JSON.'); 'Required key "StatusModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StatusModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return StatusModel( return StatusModel(
type: Object.fromJson(json[r'_type']), type: StatusModelTypeEnum.fromJson(json[r'_type']),
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
name: mapValueOfType<Object>(json, r'name'), name: mapValueOfType<Object>(json, r'name'),
position: mapValueOfType<Object>(json, r'position'), position: mapValueOfType<Object>(json, r'position'),
@ -169,7 +174,10 @@ class StatusModel {
return null; return null;
} }
static List<StatusModel> listFromJson(dynamic json, {bool growable = false,}) { static List<StatusModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StatusModel>[]; final result = <StatusModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -197,24 +205,28 @@ class StatusModel {
} }
// maps a json object with a list of StatusModel-objects as value to a dart map // maps a json object with a list of StatusModel-objects as value to a dart map
static Map<String, List<StatusModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StatusModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StatusModel>>{}; final map = <String, List<StatusModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StatusModel.listFromJson(entry.value, growable: growable,); map[entry.key] = StatusModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
} }
/// The list of required keys that must be present in a JSON. /// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{ static const requiredKeys = <String>{};
};
} }
class StatusModelTypeEnum { class StatusModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StatusModelTypeEnum._(this.value); const StatusModelTypeEnum._(this.value);
@ -234,9 +246,13 @@ class StatusModelTypeEnum {
status, status,
]; ];
static StatusModelTypeEnum? fromJson(dynamic value) => StatusModelTypeEnumTypeTransformer().decode(value); static StatusModelTypeEnum? fromJson(dynamic value) =>
StatusModelTypeEnumTypeTransformer().decode(value);
static List<StatusModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StatusModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StatusModelTypeEnum>[]; final result = <StatusModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -253,7 +269,8 @@ class StatusModelTypeEnum {
/// Transformation class that can [encode] an instance of [StatusModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StatusModelTypeEnum] to Object,
/// and [decode] dynamic data back to [StatusModelTypeEnum]. /// and [decode] dynamic data back to [StatusModelTypeEnum].
class StatusModelTypeEnumTypeTransformer { class StatusModelTypeEnumTypeTransformer {
factory StatusModelTypeEnumTypeTransformer() => _instance ??= const StatusModelTypeEnumTypeTransformer._(); factory StatusModelTypeEnumTypeTransformer() =>
_instance ??= const StatusModelTypeEnumTypeTransformer._();
const StatusModelTypeEnumTypeTransformer._(); const StatusModelTypeEnumTypeTransformer._();
@ -270,7 +287,8 @@ class StatusModelTypeEnumTypeTransformer {
StatusModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { StatusModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Status': return StatusModelTypeEnum.status; case 'Status':
return StatusModelTypeEnum.status;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -283,5 +301,3 @@ class StatusModelTypeEnumTypeTransformer {
/// Singleton [StatusModelTypeEnumTypeTransformer] instance. /// Singleton [StatusModelTypeEnumTypeTransformer] instance.
static StatusModelTypeEnumTypeTransformer? _instance; static StatusModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -96,41 +96,44 @@ class StorageFileModel {
StorageFileModelAllOfLinks links; StorageFileModelAllOfLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StorageFileModel && bool operator ==(Object other) =>
other.id == id && identical(this, other) ||
other.name == name && other is StorageFileModel &&
other.mimeType == mimeType && other.id == id &&
other.size == size && other.name == name &&
other.createdAt == createdAt && other.mimeType == mimeType &&
other.lastModifiedAt == lastModifiedAt && other.size == size &&
other.createdByName == createdByName && other.createdAt == createdAt &&
other.lastModifiedByName == lastModifiedByName && other.lastModifiedAt == lastModifiedAt &&
other.type == type && other.createdByName == createdByName &&
other.location == location && other.lastModifiedByName == lastModifiedByName &&
other.links == links; other.type == type &&
other.location == location &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(id.hashCode) + (id.hashCode) +
(name.hashCode) + (name.hashCode) +
(mimeType == null ? 0 : mimeType!.hashCode) + (mimeType == null ? 0 : mimeType!.hashCode) +
(size == null ? 0 : size!.hashCode) + (size == null ? 0 : size!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) + (lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
(createdByName == null ? 0 : createdByName!.hashCode) + (createdByName == null ? 0 : createdByName!.hashCode) +
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) + (lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(location == null ? 0 : location!.hashCode) + (location == null ? 0 : location!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'StorageFileModel[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]'; String toString() =>
'StorageFileModel[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
json[r'id'] = this.id; json[r'id'] = this.id;
json[r'name'] = this.name; json[r'name'] = this.name;
if (this.mimeType != null) { if (this.mimeType != null) {
json[r'mimeType'] = this.mimeType; json[r'mimeType'] = this.mimeType;
} else { } else {
@ -171,7 +174,7 @@ class StorageFileModel {
} else { } else {
json[r'location'] = null; json[r'location'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -187,8 +190,10 @@ class StorageFileModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StorageFileModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StorageFileModel[$key]" has a null value in JSON.'); 'Required key "StorageFileModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StorageFileModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
@ -202,7 +207,7 @@ class StorageFileModel {
lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''), lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''),
createdByName: mapValueOfType<String>(json, r'createdByName'), createdByName: mapValueOfType<String>(json, r'createdByName'),
lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'), lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'),
type: Object.fromJson(json[r'_type']), type: StorageFileModelTypeEnum.fromJson(json[r'_type']),
location: mapValueOfType<Object>(json, r'location'), location: mapValueOfType<Object>(json, r'location'),
links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!, links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!,
); );
@ -210,7 +215,10 @@ class StorageFileModel {
return null; return null;
} }
static List<StorageFileModel> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFileModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFileModel>[]; final result = <StorageFileModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -238,13 +246,19 @@ class StorageFileModel {
} }
// maps a json object with a list of StorageFileModel-objects as value to a dart map // maps a json object with a list of StorageFileModel-objects as value to a dart map
static Map<String, List<StorageFileModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StorageFileModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StorageFileModel>>{}; final map = <String, List<StorageFileModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StorageFileModel.listFromJson(entry.value, growable: growable,); map[entry.key] = StorageFileModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -260,7 +274,6 @@ class StorageFileModel {
}; };
} }
class StorageFileModelTypeEnum { class StorageFileModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StorageFileModelTypeEnum._(this.value); const StorageFileModelTypeEnum._(this.value);
@ -280,9 +293,13 @@ class StorageFileModelTypeEnum {
storageFile, storageFile,
]; ];
static StorageFileModelTypeEnum? fromJson(dynamic value) => StorageFileModelTypeEnumTypeTransformer().decode(value); static StorageFileModelTypeEnum? fromJson(dynamic value) =>
StorageFileModelTypeEnumTypeTransformer().decode(value);
static List<StorageFileModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFileModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFileModelTypeEnum>[]; final result = <StorageFileModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -299,7 +316,8 @@ class StorageFileModelTypeEnum {
/// Transformation class that can [encode] an instance of [StorageFileModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StorageFileModelTypeEnum] to Object,
/// and [decode] dynamic data back to [StorageFileModelTypeEnum]. /// and [decode] dynamic data back to [StorageFileModelTypeEnum].
class StorageFileModelTypeEnumTypeTransformer { class StorageFileModelTypeEnumTypeTransformer {
factory StorageFileModelTypeEnumTypeTransformer() => _instance ??= const StorageFileModelTypeEnumTypeTransformer._(); factory StorageFileModelTypeEnumTypeTransformer() =>
_instance ??= const StorageFileModelTypeEnumTypeTransformer._();
const StorageFileModelTypeEnumTypeTransformer._(); const StorageFileModelTypeEnumTypeTransformer._();
@ -316,7 +334,8 @@ class StorageFileModelTypeEnumTypeTransformer {
StorageFileModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { StorageFileModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'StorageFile': return StorageFileModelTypeEnum.storageFile; case 'StorageFile':
return StorageFileModelTypeEnum.storageFile;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -329,5 +348,3 @@ class StorageFileModelTypeEnumTypeTransformer {
/// Singleton [StorageFileModelTypeEnumTypeTransformer] instance. /// Singleton [StorageFileModelTypeEnumTypeTransformer] instance.
static StorageFileModelTypeEnumTypeTransformer? _instance; static StorageFileModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -22,15 +22,16 @@ class StorageFileUploadLinkModel {
StorageFileUploadLinkModelLinks links; StorageFileUploadLinkModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StorageFileUploadLinkModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.links == links; other is StorageFileUploadLinkModel &&
other.type == type &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) + (links.hashCode);
(links.hashCode);
@override @override
String toString() => 'StorageFileUploadLinkModel[type=$type, links=$links]'; String toString() => 'StorageFileUploadLinkModel[type=$type, links=$links]';
@ -42,7 +43,7 @@ class StorageFileUploadLinkModel {
} else { } else {
json[r'_type'] = null; json[r'_type'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -58,21 +59,26 @@ class StorageFileUploadLinkModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StorageFileUploadLinkModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StorageFileUploadLinkModel[$key]" has a null value in JSON.'); 'Required key "StorageFileUploadLinkModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StorageFileUploadLinkModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return StorageFileUploadLinkModel( return StorageFileUploadLinkModel(
type: Object.fromJson(json[r'_type']), type: StorageFileUploadLinkModelTypeEnum.fromJson(json[r'_type']),
links: StorageFileUploadLinkModelLinks.fromJson(json[r'_links'])!, links: StorageFileUploadLinkModelLinks.fromJson(json[r'_links'])!,
); );
} }
return null; return null;
} }
static List<StorageFileUploadLinkModel> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFileUploadLinkModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFileUploadLinkModel>[]; final result = <StorageFileUploadLinkModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -100,13 +106,19 @@ class StorageFileUploadLinkModel {
} }
// maps a json object with a list of StorageFileUploadLinkModel-objects as value to a dart map // maps a json object with a list of StorageFileUploadLinkModel-objects as value to a dart map
static Map<String, List<StorageFileUploadLinkModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StorageFileUploadLinkModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StorageFileUploadLinkModel>>{}; final map = <String, List<StorageFileUploadLinkModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StorageFileUploadLinkModel.listFromJson(entry.value, growable: growable,); map[entry.key] = StorageFileUploadLinkModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -119,7 +131,6 @@ class StorageFileUploadLinkModel {
}; };
} }
class StorageFileUploadLinkModelTypeEnum { class StorageFileUploadLinkModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StorageFileUploadLinkModelTypeEnum._(this.value); const StorageFileUploadLinkModelTypeEnum._(this.value);
@ -139,9 +150,13 @@ class StorageFileUploadLinkModelTypeEnum {
uploadLink, uploadLink,
]; ];
static StorageFileUploadLinkModelTypeEnum? fromJson(dynamic value) => StorageFileUploadLinkModelTypeEnumTypeTransformer().decode(value); static StorageFileUploadLinkModelTypeEnum? fromJson(dynamic value) =>
StorageFileUploadLinkModelTypeEnumTypeTransformer().decode(value);
static List<StorageFileUploadLinkModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFileUploadLinkModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFileUploadLinkModelTypeEnum>[]; final result = <StorageFileUploadLinkModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -158,7 +173,8 @@ class StorageFileUploadLinkModelTypeEnum {
/// Transformation class that can [encode] an instance of [StorageFileUploadLinkModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StorageFileUploadLinkModelTypeEnum] to Object,
/// and [decode] dynamic data back to [StorageFileUploadLinkModelTypeEnum]. /// and [decode] dynamic data back to [StorageFileUploadLinkModelTypeEnum].
class StorageFileUploadLinkModelTypeEnumTypeTransformer { class StorageFileUploadLinkModelTypeEnumTypeTransformer {
factory StorageFileUploadLinkModelTypeEnumTypeTransformer() => _instance ??= const StorageFileUploadLinkModelTypeEnumTypeTransformer._(); factory StorageFileUploadLinkModelTypeEnumTypeTransformer() =>
_instance ??= const StorageFileUploadLinkModelTypeEnumTypeTransformer._();
const StorageFileUploadLinkModelTypeEnumTypeTransformer._(); const StorageFileUploadLinkModelTypeEnumTypeTransformer._();
@ -172,10 +188,12 @@ class StorageFileUploadLinkModelTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
StorageFileUploadLinkModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { StorageFileUploadLinkModelTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'UploadLink': return StorageFileUploadLinkModelTypeEnum.uploadLink; case 'UploadLink':
return StorageFileUploadLinkModelTypeEnum.uploadLink;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -188,5 +206,3 @@ class StorageFileUploadLinkModelTypeEnumTypeTransformer {
/// Singleton [StorageFileUploadLinkModelTypeEnumTypeTransformer] instance. /// Singleton [StorageFileUploadLinkModelTypeEnumTypeTransformer] instance.
static StorageFileUploadLinkModelTypeEnumTypeTransformer? _instance; static StorageFileUploadLinkModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -33,24 +33,27 @@ class StorageFilesModel {
StorageFileModelAllOfLinks links; StorageFileModelAllOfLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StorageFilesModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.files == files && other is StorageFilesModel &&
other.parent == parent && other.type == type &&
other.ancestors == ancestors && other.files == files &&
other.links == links; other.parent == parent &&
other.ancestors == ancestors &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(files == null ? 0 : files!.hashCode) + (files == null ? 0 : files!.hashCode) +
(parent.hashCode) + (parent.hashCode) +
(ancestors == null ? 0 : ancestors!.hashCode) + (ancestors == null ? 0 : ancestors!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'StorageFilesModel[type=$type, files=$files, parent=$parent, ancestors=$ancestors, links=$links]'; String toString() =>
'StorageFilesModel[type=$type, files=$files, parent=$parent, ancestors=$ancestors, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -64,13 +67,13 @@ class StorageFilesModel {
} else { } else {
json[r'files'] = null; json[r'files'] = null;
} }
json[r'parent'] = this.parent; json[r'parent'] = this.parent;
if (this.ancestors != null) { if (this.ancestors != null) {
json[r'ancestors'] = this.ancestors; json[r'ancestors'] = this.ancestors;
} else { } else {
json[r'ancestors'] = null; json[r'ancestors'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -86,14 +89,16 @@ class StorageFilesModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StorageFilesModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StorageFilesModel[$key]" has a null value in JSON.'); 'Required key "StorageFilesModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StorageFilesModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return StorageFilesModel( return StorageFilesModel(
type: Object.fromJson(json[r'_type']), type: StorageFilesModelTypeEnum.fromJson(json[r'_type']),
files: mapValueOfType<Object>(json, r'files'), files: mapValueOfType<Object>(json, r'files'),
parent: StorageFilesModelParent.fromJson(json[r'parent'])!, parent: StorageFilesModelParent.fromJson(json[r'parent'])!,
ancestors: mapValueOfType<Object>(json, r'ancestors'), ancestors: mapValueOfType<Object>(json, r'ancestors'),
@ -103,7 +108,10 @@ class StorageFilesModel {
return null; return null;
} }
static List<StorageFilesModel> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFilesModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFilesModel>[]; final result = <StorageFilesModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -131,13 +139,19 @@ class StorageFilesModel {
} }
// maps a json object with a list of StorageFilesModel-objects as value to a dart map // maps a json object with a list of StorageFilesModel-objects as value to a dart map
static Map<String, List<StorageFilesModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StorageFilesModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StorageFilesModel>>{}; final map = <String, List<StorageFilesModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StorageFilesModel.listFromJson(entry.value, growable: growable,); map[entry.key] = StorageFilesModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -153,7 +167,6 @@ class StorageFilesModel {
}; };
} }
class StorageFilesModelTypeEnum { class StorageFilesModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StorageFilesModelTypeEnum._(this.value); const StorageFilesModelTypeEnum._(this.value);
@ -173,9 +186,13 @@ class StorageFilesModelTypeEnum {
storageFiles, storageFiles,
]; ];
static StorageFilesModelTypeEnum? fromJson(dynamic value) => StorageFilesModelTypeEnumTypeTransformer().decode(value); static StorageFilesModelTypeEnum? fromJson(dynamic value) =>
StorageFilesModelTypeEnumTypeTransformer().decode(value);
static List<StorageFilesModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFilesModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFilesModelTypeEnum>[]; final result = <StorageFilesModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -192,7 +209,8 @@ class StorageFilesModelTypeEnum {
/// Transformation class that can [encode] an instance of [StorageFilesModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StorageFilesModelTypeEnum] to Object,
/// and [decode] dynamic data back to [StorageFilesModelTypeEnum]. /// and [decode] dynamic data back to [StorageFilesModelTypeEnum].
class StorageFilesModelTypeEnumTypeTransformer { class StorageFilesModelTypeEnumTypeTransformer {
factory StorageFilesModelTypeEnumTypeTransformer() => _instance ??= const StorageFilesModelTypeEnumTypeTransformer._(); factory StorageFilesModelTypeEnumTypeTransformer() =>
_instance ??= const StorageFilesModelTypeEnumTypeTransformer._();
const StorageFilesModelTypeEnumTypeTransformer._(); const StorageFilesModelTypeEnumTypeTransformer._();
@ -209,7 +227,8 @@ class StorageFilesModelTypeEnumTypeTransformer {
StorageFilesModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { StorageFilesModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'StorageFiles': return StorageFilesModelTypeEnum.storageFiles; case 'StorageFiles':
return StorageFilesModelTypeEnum.storageFiles;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -222,5 +241,3 @@ class StorageFilesModelTypeEnumTypeTransformer {
/// Singleton [StorageFilesModelTypeEnumTypeTransformer] instance. /// Singleton [StorageFilesModelTypeEnumTypeTransformer] instance.
static StorageFilesModelTypeEnumTypeTransformer? _instance; static StorageFilesModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -96,41 +96,44 @@ class StorageFilesModelParent {
StorageFileModelAllOfLinks links; StorageFileModelAllOfLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StorageFilesModelParent && bool operator ==(Object other) =>
other.id == id && identical(this, other) ||
other.name == name && other is StorageFilesModelParent &&
other.mimeType == mimeType && other.id == id &&
other.size == size && other.name == name &&
other.createdAt == createdAt && other.mimeType == mimeType &&
other.lastModifiedAt == lastModifiedAt && other.size == size &&
other.createdByName == createdByName && other.createdAt == createdAt &&
other.lastModifiedByName == lastModifiedByName && other.lastModifiedAt == lastModifiedAt &&
other.type == type && other.createdByName == createdByName &&
other.location == location && other.lastModifiedByName == lastModifiedByName &&
other.links == links; other.type == type &&
other.location == location &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(id.hashCode) + (id.hashCode) +
(name.hashCode) + (name.hashCode) +
(mimeType == null ? 0 : mimeType!.hashCode) + (mimeType == null ? 0 : mimeType!.hashCode) +
(size == null ? 0 : size!.hashCode) + (size == null ? 0 : size!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) + (lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
(createdByName == null ? 0 : createdByName!.hashCode) + (createdByName == null ? 0 : createdByName!.hashCode) +
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) + (lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(location == null ? 0 : location!.hashCode) + (location == null ? 0 : location!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'StorageFilesModelParent[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]'; String toString() =>
'StorageFilesModelParent[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
json[r'id'] = this.id; json[r'id'] = this.id;
json[r'name'] = this.name; json[r'name'] = this.name;
if (this.mimeType != null) { if (this.mimeType != null) {
json[r'mimeType'] = this.mimeType; json[r'mimeType'] = this.mimeType;
} else { } else {
@ -171,7 +174,7 @@ class StorageFilesModelParent {
} else { } else {
json[r'location'] = null; json[r'location'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -187,8 +190,10 @@ class StorageFilesModelParent {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StorageFilesModelParent[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StorageFilesModelParent[$key]" has a null value in JSON.'); 'Required key "StorageFilesModelParent[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StorageFilesModelParent[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
@ -202,7 +207,7 @@ class StorageFilesModelParent {
lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''), lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''),
createdByName: mapValueOfType<String>(json, r'createdByName'), createdByName: mapValueOfType<String>(json, r'createdByName'),
lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'), lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'),
type: Object.fromJson(json[r'_type']), type: StorageFilesModelParentTypeEnum.fromJson(json[r'_type']),
location: mapValueOfType<Object>(json, r'location'), location: mapValueOfType<Object>(json, r'location'),
links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!, links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!,
); );
@ -210,7 +215,10 @@ class StorageFilesModelParent {
return null; return null;
} }
static List<StorageFilesModelParent> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFilesModelParent> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFilesModelParent>[]; final result = <StorageFilesModelParent>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -238,13 +246,19 @@ class StorageFilesModelParent {
} }
// maps a json object with a list of StorageFilesModelParent-objects as value to a dart map // maps a json object with a list of StorageFilesModelParent-objects as value to a dart map
static Map<String, List<StorageFilesModelParent>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StorageFilesModelParent>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StorageFilesModelParent>>{}; final map = <String, List<StorageFilesModelParent>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StorageFilesModelParent.listFromJson(entry.value, growable: growable,); map[entry.key] = StorageFilesModelParent.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -260,7 +274,6 @@ class StorageFilesModelParent {
}; };
} }
class StorageFilesModelParentTypeEnum { class StorageFilesModelParentTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StorageFilesModelParentTypeEnum._(this.value); const StorageFilesModelParentTypeEnum._(this.value);
@ -280,9 +293,13 @@ class StorageFilesModelParentTypeEnum {
storageFile, storageFile,
]; ];
static StorageFilesModelParentTypeEnum? fromJson(dynamic value) => StorageFilesModelParentTypeEnumTypeTransformer().decode(value); static StorageFilesModelParentTypeEnum? fromJson(dynamic value) =>
StorageFilesModelParentTypeEnumTypeTransformer().decode(value);
static List<StorageFilesModelParentTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageFilesModelParentTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageFilesModelParentTypeEnum>[]; final result = <StorageFilesModelParentTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -299,7 +316,8 @@ class StorageFilesModelParentTypeEnum {
/// Transformation class that can [encode] an instance of [StorageFilesModelParentTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StorageFilesModelParentTypeEnum] to Object,
/// and [decode] dynamic data back to [StorageFilesModelParentTypeEnum]. /// and [decode] dynamic data back to [StorageFilesModelParentTypeEnum].
class StorageFilesModelParentTypeEnumTypeTransformer { class StorageFilesModelParentTypeEnumTypeTransformer {
factory StorageFilesModelParentTypeEnumTypeTransformer() => _instance ??= const StorageFilesModelParentTypeEnumTypeTransformer._(); factory StorageFilesModelParentTypeEnumTypeTransformer() =>
_instance ??= const StorageFilesModelParentTypeEnumTypeTransformer._();
const StorageFilesModelParentTypeEnumTypeTransformer._(); const StorageFilesModelParentTypeEnumTypeTransformer._();
@ -313,10 +331,12 @@ class StorageFilesModelParentTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
StorageFilesModelParentTypeEnum? decode(dynamic data, {bool allowNull = true}) { StorageFilesModelParentTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'StorageFile': return StorageFilesModelParentTypeEnum.storageFile; case 'StorageFile':
return StorageFilesModelParentTypeEnum.storageFile;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -329,5 +349,3 @@ class StorageFilesModelParentTypeEnumTypeTransformer {
/// Singleton [StorageFilesModelParentTypeEnumTypeTransformer] instance. /// Singleton [StorageFilesModelParentTypeEnumTypeTransformer] instance.
static StorageFilesModelParentTypeEnumTypeTransformer? _instance; static StorageFilesModelParentTypeEnumTypeTransformer? _instance;
} }

View File

@ -51,30 +51,33 @@ class StorageReadModel {
StorageReadModelLinks links; StorageReadModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is StorageReadModel && bool operator ==(Object other) =>
other.id == id && identical(this, other) ||
other.type == type && other is StorageReadModel &&
other.name == name && other.id == id &&
other.hasApplicationPassword == hasApplicationPassword && other.type == type &&
other.createdAt == createdAt && other.name == name &&
other.updatedAt == updatedAt && other.hasApplicationPassword == hasApplicationPassword &&
other.embedded == embedded && other.createdAt == createdAt &&
other.links == links; other.updatedAt == updatedAt &&
other.embedded == embedded &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(hasApplicationPassword == null ? 0 : hasApplicationPassword!.hashCode) + (hasApplicationPassword == null ? 0 : hasApplicationPassword!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(updatedAt == null ? 0 : updatedAt!.hashCode) + (updatedAt == null ? 0 : updatedAt!.hashCode) +
(embedded == null ? 0 : embedded!.hashCode) + (embedded == null ? 0 : embedded!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'StorageReadModel[id=$id, type=$type, name=$name, hasApplicationPassword=$hasApplicationPassword, createdAt=$createdAt, updatedAt=$updatedAt, embedded=$embedded, links=$links]'; String toString() =>
'StorageReadModel[id=$id, type=$type, name=$name, hasApplicationPassword=$hasApplicationPassword, createdAt=$createdAt, updatedAt=$updatedAt, embedded=$embedded, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -113,7 +116,7 @@ class StorageReadModel {
} else { } else {
json[r'_embedded'] = null; json[r'_embedded'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -129,17 +132,20 @@ class StorageReadModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "StorageReadModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "StorageReadModel[$key]" has a null value in JSON.'); 'Required key "StorageReadModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "StorageReadModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return StorageReadModel( return StorageReadModel(
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
type: Object.fromJson(json[r'_type']), type: StorageReadModelTypeEnum.fromJson(json[r'_type']),
name: mapValueOfType<Object>(json, r'name'), name: mapValueOfType<Object>(json, r'name'),
hasApplicationPassword: mapValueOfType<Object>(json, r'hasApplicationPassword'), hasApplicationPassword:
mapValueOfType<Object>(json, r'hasApplicationPassword'),
createdAt: mapValueOfType<Object>(json, r'createdAt'), createdAt: mapValueOfType<Object>(json, r'createdAt'),
updatedAt: mapValueOfType<Object>(json, r'updatedAt'), updatedAt: mapValueOfType<Object>(json, r'updatedAt'),
embedded: StorageReadModelEmbedded.fromJson(json[r'_embedded']), embedded: StorageReadModelEmbedded.fromJson(json[r'_embedded']),
@ -149,7 +155,10 @@ class StorageReadModel {
return null; return null;
} }
static List<StorageReadModel> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageReadModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageReadModel>[]; final result = <StorageReadModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -177,13 +186,19 @@ class StorageReadModel {
} }
// maps a json object with a list of StorageReadModel-objects as value to a dart map // maps a json object with a list of StorageReadModel-objects as value to a dart map
static Map<String, List<StorageReadModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<StorageReadModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<StorageReadModel>>{}; final map = <String, List<StorageReadModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = StorageReadModel.listFromJson(entry.value, growable: growable,); map[entry.key] = StorageReadModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -198,7 +213,6 @@ class StorageReadModel {
}; };
} }
class StorageReadModelTypeEnum { class StorageReadModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const StorageReadModelTypeEnum._(this.value); const StorageReadModelTypeEnum._(this.value);
@ -218,9 +232,13 @@ class StorageReadModelTypeEnum {
storage, storage,
]; ];
static StorageReadModelTypeEnum? fromJson(dynamic value) => StorageReadModelTypeEnumTypeTransformer().decode(value); static StorageReadModelTypeEnum? fromJson(dynamic value) =>
StorageReadModelTypeEnumTypeTransformer().decode(value);
static List<StorageReadModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<StorageReadModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <StorageReadModelTypeEnum>[]; final result = <StorageReadModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -237,7 +255,8 @@ class StorageReadModelTypeEnum {
/// Transformation class that can [encode] an instance of [StorageReadModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [StorageReadModelTypeEnum] to Object,
/// and [decode] dynamic data back to [StorageReadModelTypeEnum]. /// and [decode] dynamic data back to [StorageReadModelTypeEnum].
class StorageReadModelTypeEnumTypeTransformer { class StorageReadModelTypeEnumTypeTransformer {
factory StorageReadModelTypeEnumTypeTransformer() => _instance ??= const StorageReadModelTypeEnumTypeTransformer._(); factory StorageReadModelTypeEnumTypeTransformer() =>
_instance ??= const StorageReadModelTypeEnumTypeTransformer._();
const StorageReadModelTypeEnumTypeTransformer._(); const StorageReadModelTypeEnumTypeTransformer._();
@ -254,7 +273,8 @@ class StorageReadModelTypeEnumTypeTransformer {
StorageReadModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { StorageReadModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Storage': return StorageReadModelTypeEnum.storage; case 'Storage':
return StorageReadModelTypeEnum.storage;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -267,5 +287,3 @@ class StorageReadModelTypeEnumTypeTransformer {
/// Singleton [StorageReadModelTypeEnumTypeTransformer] instance. /// Singleton [StorageReadModelTypeEnumTypeTransformer] instance.
static StorageReadModelTypeEnumTypeTransformer? _instance; static StorageReadModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -43,28 +43,31 @@ class TimeEntryActivityModel {
TimeEntryActivityModelLinks links; TimeEntryActivityModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is TimeEntryActivityModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.id == id && other is TimeEntryActivityModel &&
other.name == name && other.type == type &&
other.position == position && other.id == id &&
other.default_ == default_ && other.name == name &&
other.embedded == embedded && other.position == position &&
other.links == links; other.default_ == default_ &&
other.embedded == embedded &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(position == null ? 0 : position!.hashCode) + (position == null ? 0 : position!.hashCode) +
(default_ == null ? 0 : default_!.hashCode) + (default_ == null ? 0 : default_!.hashCode) +
(embedded.hashCode) + (embedded.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'TimeEntryActivityModel[type=$type, id=$id, name=$name, position=$position, default_=$default_, embedded=$embedded, links=$links]'; String toString() =>
'TimeEntryActivityModel[type=$type, id=$id, name=$name, position=$position, default_=$default_, embedded=$embedded, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -93,8 +96,8 @@ class TimeEntryActivityModel {
} else { } else {
json[r'default'] = null; json[r'default'] = null;
} }
json[r'_embedded'] = this.embedded; json[r'_embedded'] = this.embedded;
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -110,14 +113,16 @@ class TimeEntryActivityModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "TimeEntryActivityModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "TimeEntryActivityModel[$key]" has a null value in JSON.'); 'Required key "TimeEntryActivityModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "TimeEntryActivityModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return TimeEntryActivityModel( return TimeEntryActivityModel(
type: Object.fromJson(json[r'_type']), type: TimeEntryActivityModelTypeEnum.fromJson(json[r'_type']),
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
name: mapValueOfType<Object>(json, r'name'), name: mapValueOfType<Object>(json, r'name'),
position: mapValueOfType<Object>(json, r'position'), position: mapValueOfType<Object>(json, r'position'),
@ -129,7 +134,10 @@ class TimeEntryActivityModel {
return null; return null;
} }
static List<TimeEntryActivityModel> listFromJson(dynamic json, {bool growable = false,}) { static List<TimeEntryActivityModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <TimeEntryActivityModel>[]; final result = <TimeEntryActivityModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -157,13 +165,19 @@ class TimeEntryActivityModel {
} }
// maps a json object with a list of TimeEntryActivityModel-objects as value to a dart map // maps a json object with a list of TimeEntryActivityModel-objects as value to a dart map
static Map<String, List<TimeEntryActivityModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<TimeEntryActivityModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<TimeEntryActivityModel>>{}; final map = <String, List<TimeEntryActivityModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = TimeEntryActivityModel.listFromJson(entry.value, growable: growable,); map[entry.key] = TimeEntryActivityModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -181,7 +195,6 @@ class TimeEntryActivityModel {
}; };
} }
class TimeEntryActivityModelTypeEnum { class TimeEntryActivityModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const TimeEntryActivityModelTypeEnum._(this.value); const TimeEntryActivityModelTypeEnum._(this.value);
@ -194,16 +207,21 @@ class TimeEntryActivityModelTypeEnum {
Object toJson() => value; Object toJson() => value;
static const timeEntriesActivity = TimeEntryActivityModelTypeEnum._('TimeEntriesActivity'); static const timeEntriesActivity =
TimeEntryActivityModelTypeEnum._('TimeEntriesActivity');
/// List of all possible values in this [enum][TimeEntryActivityModelTypeEnum]. /// List of all possible values in this [enum][TimeEntryActivityModelTypeEnum].
static const values = <TimeEntryActivityModelTypeEnum>[ static const values = <TimeEntryActivityModelTypeEnum>[
timeEntriesActivity, timeEntriesActivity,
]; ];
static TimeEntryActivityModelTypeEnum? fromJson(dynamic value) => TimeEntryActivityModelTypeEnumTypeTransformer().decode(value); static TimeEntryActivityModelTypeEnum? fromJson(dynamic value) =>
TimeEntryActivityModelTypeEnumTypeTransformer().decode(value);
static List<TimeEntryActivityModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<TimeEntryActivityModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <TimeEntryActivityModelTypeEnum>[]; final result = <TimeEntryActivityModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -220,7 +238,8 @@ class TimeEntryActivityModelTypeEnum {
/// Transformation class that can [encode] an instance of [TimeEntryActivityModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [TimeEntryActivityModelTypeEnum] to Object,
/// and [decode] dynamic data back to [TimeEntryActivityModelTypeEnum]. /// and [decode] dynamic data back to [TimeEntryActivityModelTypeEnum].
class TimeEntryActivityModelTypeEnumTypeTransformer { class TimeEntryActivityModelTypeEnumTypeTransformer {
factory TimeEntryActivityModelTypeEnumTypeTransformer() => _instance ??= const TimeEntryActivityModelTypeEnumTypeTransformer._(); factory TimeEntryActivityModelTypeEnumTypeTransformer() =>
_instance ??= const TimeEntryActivityModelTypeEnumTypeTransformer._();
const TimeEntryActivityModelTypeEnumTypeTransformer._(); const TimeEntryActivityModelTypeEnumTypeTransformer._();
@ -234,10 +253,12 @@ class TimeEntryActivityModelTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
TimeEntryActivityModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { TimeEntryActivityModelTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'TimeEntriesActivity': return TimeEntryActivityModelTypeEnum.timeEntriesActivity; case 'TimeEntriesActivity':
return TimeEntryActivityModelTypeEnum.timeEntriesActivity;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -250,5 +271,3 @@ class TimeEntryActivityModelTypeEnumTypeTransformer {
/// Singleton [TimeEntryActivityModelTypeEnumTypeTransformer] instance. /// Singleton [TimeEntryActivityModelTypeEnumTypeTransformer] instance.
static TimeEntryActivityModelTypeEnumTypeTransformer? _instance; static TimeEntryActivityModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -76,44 +76,47 @@ class UserModel {
UserModelLinks links; UserModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is UserModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.id == id && other is UserModel &&
other.login == login && other.type == type &&
other.firstName == firstName && other.id == id &&
other.lastName == lastName && other.login == login &&
other.name == name && other.firstName == firstName &&
other.email == email && other.lastName == lastName &&
other.admin == admin && other.name == name &&
other.avatar == avatar && other.email == email &&
other.status == status && other.admin == admin &&
other.language == language && other.avatar == avatar &&
other.identityUrl == identityUrl && other.status == status &&
other.createdAt == createdAt && other.language == language &&
other.updatedAt == updatedAt && other.identityUrl == identityUrl &&
other.links == links; other.createdAt == createdAt &&
other.updatedAt == updatedAt &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(login == null ? 0 : login!.hashCode) + (login == null ? 0 : login!.hashCode) +
(firstName == null ? 0 : firstName!.hashCode) + (firstName == null ? 0 : firstName!.hashCode) +
(lastName == null ? 0 : lastName!.hashCode) + (lastName == null ? 0 : lastName!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(email == null ? 0 : email!.hashCode) + (email == null ? 0 : email!.hashCode) +
(admin == null ? 0 : admin!.hashCode) + (admin == null ? 0 : admin!.hashCode) +
(avatar == null ? 0 : avatar!.hashCode) + (avatar == null ? 0 : avatar!.hashCode) +
(status == null ? 0 : status!.hashCode) + (status == null ? 0 : status!.hashCode) +
(language == null ? 0 : language!.hashCode) + (language == null ? 0 : language!.hashCode) +
(identityUrl == null ? 0 : identityUrl!.hashCode) + (identityUrl == null ? 0 : identityUrl!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(updatedAt == null ? 0 : updatedAt!.hashCode) + (updatedAt == null ? 0 : updatedAt!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'UserModel[type=$type, id=$id, login=$login, firstName=$firstName, lastName=$lastName, name=$name, email=$email, admin=$admin, avatar=$avatar, status=$status, language=$language, identityUrl=$identityUrl, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]'; String toString() =>
'UserModel[type=$type, id=$id, login=$login, firstName=$firstName, lastName=$lastName, name=$name, email=$email, admin=$admin, avatar=$avatar, status=$status, language=$language, identityUrl=$identityUrl, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -187,7 +190,7 @@ class UserModel {
} else { } else {
json[r'updatedAt'] = null; json[r'updatedAt'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -203,14 +206,16 @@ class UserModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "UserModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "UserModel[$key]" has a null value in JSON.'); 'Required key "UserModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "UserModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return UserModel( return UserModel(
type: Object.fromJson(json[r'_type']), type: UserModelTypeEnum.fromJson(json[r'_type']),
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
login: mapValueOfType<Object>(json, r'login'), login: mapValueOfType<Object>(json, r'login'),
firstName: mapValueOfType<Object>(json, r'firstName'), firstName: mapValueOfType<Object>(json, r'firstName'),
@ -230,7 +235,10 @@ class UserModel {
return null; return null;
} }
static List<UserModel> listFromJson(dynamic json, {bool growable = false,}) { static List<UserModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <UserModel>[]; final result = <UserModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -258,13 +266,19 @@ class UserModel {
} }
// maps a json object with a list of UserModel-objects as value to a dart map // maps a json object with a list of UserModel-objects as value to a dart map
static Map<String, List<UserModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<UserModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<UserModel>>{}; final map = <String, List<UserModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = UserModel.listFromJson(entry.value, growable: growable,); map[entry.key] = UserModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -280,7 +294,6 @@ class UserModel {
}; };
} }
class UserModelTypeEnum { class UserModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const UserModelTypeEnum._(this.value); const UserModelTypeEnum._(this.value);
@ -300,9 +313,13 @@ class UserModelTypeEnum {
user, user,
]; ];
static UserModelTypeEnum? fromJson(dynamic value) => UserModelTypeEnumTypeTransformer().decode(value); static UserModelTypeEnum? fromJson(dynamic value) =>
UserModelTypeEnumTypeTransformer().decode(value);
static List<UserModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<UserModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <UserModelTypeEnum>[]; final result = <UserModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -319,7 +336,8 @@ class UserModelTypeEnum {
/// Transformation class that can [encode] an instance of [UserModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [UserModelTypeEnum] to Object,
/// and [decode] dynamic data back to [UserModelTypeEnum]. /// and [decode] dynamic data back to [UserModelTypeEnum].
class UserModelTypeEnumTypeTransformer { class UserModelTypeEnumTypeTransformer {
factory UserModelTypeEnumTypeTransformer() => _instance ??= const UserModelTypeEnumTypeTransformer._(); factory UserModelTypeEnumTypeTransformer() =>
_instance ??= const UserModelTypeEnumTypeTransformer._();
const UserModelTypeEnumTypeTransformer._(); const UserModelTypeEnumTypeTransformer._();
@ -336,7 +354,8 @@ class UserModelTypeEnumTypeTransformer {
UserModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { UserModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'User': return UserModelTypeEnum.user; case 'User':
return UserModelTypeEnum.user;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -349,5 +368,3 @@ class UserModelTypeEnumTypeTransformer {
/// Singleton [UserModelTypeEnumTypeTransformer] instance. /// Singleton [UserModelTypeEnumTypeTransformer] instance.
static UserModelTypeEnumTypeTransformer? _instance; static UserModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -30,22 +30,25 @@ class ValuesPropertyModel {
ValuesPropertyModelLinks links; ValuesPropertyModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is ValuesPropertyModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.property == property && other is ValuesPropertyModel &&
other.value == value && other.type == type &&
other.links == links; other.property == property &&
other.value == value &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(property == null ? 0 : property!.hashCode) + (property == null ? 0 : property!.hashCode) +
(value == null ? 0 : value!.hashCode) + (value == null ? 0 : value!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'ValuesPropertyModel[type=$type, property=$property, value=$value, links=$links]'; String toString() =>
'ValuesPropertyModel[type=$type, property=$property, value=$value, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -64,7 +67,7 @@ class ValuesPropertyModel {
} else { } else {
json[r'value'] = null; json[r'value'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -80,14 +83,16 @@ class ValuesPropertyModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "ValuesPropertyModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "ValuesPropertyModel[$key]" has a null value in JSON.'); 'Required key "ValuesPropertyModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "ValuesPropertyModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return ValuesPropertyModel( return ValuesPropertyModel(
type: Object.fromJson(json[r'_type']), type: ValuesPropertyModelTypeEnum.fromJson(json[r'_type']),
property: mapValueOfType<Object>(json, r'property'), property: mapValueOfType<Object>(json, r'property'),
value: mapValueOfType<Object>(json, r'value'), value: mapValueOfType<Object>(json, r'value'),
links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!, links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!,
@ -96,7 +101,10 @@ class ValuesPropertyModel {
return null; return null;
} }
static List<ValuesPropertyModel> listFromJson(dynamic json, {bool growable = false,}) { static List<ValuesPropertyModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <ValuesPropertyModel>[]; final result = <ValuesPropertyModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -124,13 +132,19 @@ class ValuesPropertyModel {
} }
// maps a json object with a list of ValuesPropertyModel-objects as value to a dart map // maps a json object with a list of ValuesPropertyModel-objects as value to a dart map
static Map<String, List<ValuesPropertyModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<ValuesPropertyModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<ValuesPropertyModel>>{}; final map = <String, List<ValuesPropertyModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = ValuesPropertyModel.listFromJson(entry.value, growable: growable,); map[entry.key] = ValuesPropertyModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -145,7 +159,6 @@ class ValuesPropertyModel {
}; };
} }
class ValuesPropertyModelTypeEnum { class ValuesPropertyModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const ValuesPropertyModelTypeEnum._(this.value); const ValuesPropertyModelTypeEnum._(this.value);
@ -158,16 +171,21 @@ class ValuesPropertyModelTypeEnum {
Object toJson() => value; Object toJson() => value;
static const valuesColonColonProperty = ValuesPropertyModelTypeEnum._('Values::Property'); static const valuesColonColonProperty =
ValuesPropertyModelTypeEnum._('Values::Property');
/// List of all possible values in this [enum][ValuesPropertyModelTypeEnum]. /// List of all possible values in this [enum][ValuesPropertyModelTypeEnum].
static const values = <ValuesPropertyModelTypeEnum>[ static const values = <ValuesPropertyModelTypeEnum>[
valuesColonColonProperty, valuesColonColonProperty,
]; ];
static ValuesPropertyModelTypeEnum? fromJson(dynamic value) => ValuesPropertyModelTypeEnumTypeTransformer().decode(value); static ValuesPropertyModelTypeEnum? fromJson(dynamic value) =>
ValuesPropertyModelTypeEnumTypeTransformer().decode(value);
static List<ValuesPropertyModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<ValuesPropertyModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <ValuesPropertyModelTypeEnum>[]; final result = <ValuesPropertyModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -184,7 +202,8 @@ class ValuesPropertyModelTypeEnum {
/// Transformation class that can [encode] an instance of [ValuesPropertyModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [ValuesPropertyModelTypeEnum] to Object,
/// and [decode] dynamic data back to [ValuesPropertyModelTypeEnum]. /// and [decode] dynamic data back to [ValuesPropertyModelTypeEnum].
class ValuesPropertyModelTypeEnumTypeTransformer { class ValuesPropertyModelTypeEnumTypeTransformer {
factory ValuesPropertyModelTypeEnumTypeTransformer() => _instance ??= const ValuesPropertyModelTypeEnumTypeTransformer._(); factory ValuesPropertyModelTypeEnumTypeTransformer() =>
_instance ??= const ValuesPropertyModelTypeEnumTypeTransformer._();
const ValuesPropertyModelTypeEnumTypeTransformer._(); const ValuesPropertyModelTypeEnumTypeTransformer._();
@ -201,7 +220,8 @@ class ValuesPropertyModelTypeEnumTypeTransformer {
ValuesPropertyModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { ValuesPropertyModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Values::Property': return ValuesPropertyModelTypeEnum.valuesColonColonProperty; case 'Values::Property':
return ValuesPropertyModelTypeEnum.valuesColonColonProperty;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -214,5 +234,3 @@ class ValuesPropertyModelTypeEnumTypeTransformer {
/// Singleton [ValuesPropertyModelTypeEnumTypeTransformer] instance. /// Singleton [ValuesPropertyModelTypeEnumTypeTransformer] instance.
static ValuesPropertyModelTypeEnumTypeTransformer? _instance; static ValuesPropertyModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -22,18 +22,20 @@ class WeekDayCollectionWriteModel {
WeekDayCollectionWriteModelEmbedded embedded; WeekDayCollectionWriteModelEmbedded embedded;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WeekDayCollectionWriteModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.embedded == embedded; other is WeekDayCollectionWriteModel &&
other.type == type &&
other.embedded == embedded;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) + (embedded.hashCode);
(embedded.hashCode);
@override @override
String toString() => 'WeekDayCollectionWriteModel[type=$type, embedded=$embedded]'; String toString() =>
'WeekDayCollectionWriteModel[type=$type, embedded=$embedded]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -42,7 +44,7 @@ class WeekDayCollectionWriteModel {
} else { } else {
json[r'_type'] = null; json[r'_type'] = null;
} }
json[r'_embedded'] = this.embedded; json[r'_embedded'] = this.embedded;
return json; return json;
} }
@ -58,21 +60,27 @@ class WeekDayCollectionWriteModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "WeekDayCollectionWriteModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "WeekDayCollectionWriteModel[$key]" has a null value in JSON.'); 'Required key "WeekDayCollectionWriteModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "WeekDayCollectionWriteModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return WeekDayCollectionWriteModel( return WeekDayCollectionWriteModel(
type: Object.fromJson(json[r'_type']), type: WeekDayCollectionWriteModelTypeEnum.fromJson(json[r'_type']),
embedded: WeekDayCollectionWriteModelEmbedded.fromJson(json[r'_embedded'])!, embedded:
WeekDayCollectionWriteModelEmbedded.fromJson(json[r'_embedded'])!,
); );
} }
return null; return null;
} }
static List<WeekDayCollectionWriteModel> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayCollectionWriteModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayCollectionWriteModel>[]; final result = <WeekDayCollectionWriteModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -100,13 +108,19 @@ class WeekDayCollectionWriteModel {
} }
// maps a json object with a list of WeekDayCollectionWriteModel-objects as value to a dart map // maps a json object with a list of WeekDayCollectionWriteModel-objects as value to a dart map
static Map<String, List<WeekDayCollectionWriteModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<WeekDayCollectionWriteModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<WeekDayCollectionWriteModel>>{}; final map = <String, List<WeekDayCollectionWriteModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = WeekDayCollectionWriteModel.listFromJson(entry.value, growable: growable,); map[entry.key] = WeekDayCollectionWriteModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -119,7 +133,6 @@ class WeekDayCollectionWriteModel {
}; };
} }
class WeekDayCollectionWriteModelTypeEnum { class WeekDayCollectionWriteModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const WeekDayCollectionWriteModelTypeEnum._(this.value); const WeekDayCollectionWriteModelTypeEnum._(this.value);
@ -139,9 +152,13 @@ class WeekDayCollectionWriteModelTypeEnum {
collection, collection,
]; ];
static WeekDayCollectionWriteModelTypeEnum? fromJson(dynamic value) => WeekDayCollectionWriteModelTypeEnumTypeTransformer().decode(value); static WeekDayCollectionWriteModelTypeEnum? fromJson(dynamic value) =>
WeekDayCollectionWriteModelTypeEnumTypeTransformer().decode(value);
static List<WeekDayCollectionWriteModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayCollectionWriteModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayCollectionWriteModelTypeEnum>[]; final result = <WeekDayCollectionWriteModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -158,7 +175,8 @@ class WeekDayCollectionWriteModelTypeEnum {
/// Transformation class that can [encode] an instance of [WeekDayCollectionWriteModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [WeekDayCollectionWriteModelTypeEnum] to Object,
/// and [decode] dynamic data back to [WeekDayCollectionWriteModelTypeEnum]. /// and [decode] dynamic data back to [WeekDayCollectionWriteModelTypeEnum].
class WeekDayCollectionWriteModelTypeEnumTypeTransformer { class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
factory WeekDayCollectionWriteModelTypeEnumTypeTransformer() => _instance ??= const WeekDayCollectionWriteModelTypeEnumTypeTransformer._(); factory WeekDayCollectionWriteModelTypeEnumTypeTransformer() => _instance ??=
const WeekDayCollectionWriteModelTypeEnumTypeTransformer._();
const WeekDayCollectionWriteModelTypeEnumTypeTransformer._(); const WeekDayCollectionWriteModelTypeEnumTypeTransformer._();
@ -172,10 +190,12 @@ class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
/// ///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed, /// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code. /// and users are still using an old app with the old code.
WeekDayCollectionWriteModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { WeekDayCollectionWriteModelTypeEnum? decode(dynamic data,
{bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'Collection': return WeekDayCollectionWriteModelTypeEnum.collection; case 'Collection':
return WeekDayCollectionWriteModelTypeEnum.collection;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -188,5 +208,3 @@ class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
/// Singleton [WeekDayCollectionWriteModelTypeEnumTypeTransformer] instance. /// Singleton [WeekDayCollectionWriteModelTypeEnumTypeTransformer] instance.
static WeekDayCollectionWriteModelTypeEnumTypeTransformer? _instance; static WeekDayCollectionWriteModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -43,24 +43,27 @@ class WeekDayModel {
WeekDaySelfLinkModel? links; WeekDaySelfLinkModel? links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WeekDayModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.day == day && other is WeekDayModel &&
other.name == name && other.type == type &&
other.working == working && other.day == day &&
other.links == links; other.name == name &&
other.working == working &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(day == null ? 0 : day!.hashCode) + (day == null ? 0 : day!.hashCode) +
(name == null ? 0 : name!.hashCode) + (name == null ? 0 : name!.hashCode) +
(working == null ? 0 : working!.hashCode) + (working == null ? 0 : working!.hashCode) +
(links == null ? 0 : links!.hashCode); (links == null ? 0 : links!.hashCode);
@override @override
String toString() => 'WeekDayModel[type=$type, day=$day, name=$name, working=$working, links=$links]'; String toString() =>
'WeekDayModel[type=$type, day=$day, name=$name, working=$working, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -104,14 +107,16 @@ class WeekDayModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "WeekDayModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "WeekDayModel[$key]" has a null value in JSON.'); 'Required key "WeekDayModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "WeekDayModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return WeekDayModel( return WeekDayModel(
type: Object.fromJson(json[r'_type']), type: WeekDayModelTypeEnum.fromJson(json[r'_type']),
day: mapValueOfType<Object>(json, r'day'), day: mapValueOfType<Object>(json, r'day'),
name: mapValueOfType<Object>(json, r'name'), name: mapValueOfType<Object>(json, r'name'),
working: mapValueOfType<Object>(json, r'working'), working: mapValueOfType<Object>(json, r'working'),
@ -121,7 +126,10 @@ class WeekDayModel {
return null; return null;
} }
static List<WeekDayModel> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayModel>[]; final result = <WeekDayModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -149,13 +157,19 @@ class WeekDayModel {
} }
// maps a json object with a list of WeekDayModel-objects as value to a dart map // maps a json object with a list of WeekDayModel-objects as value to a dart map
static Map<String, List<WeekDayModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<WeekDayModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<WeekDayModel>>{}; final map = <String, List<WeekDayModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = WeekDayModel.listFromJson(entry.value, growable: growable,); map[entry.key] = WeekDayModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -170,7 +184,6 @@ class WeekDayModel {
}; };
} }
class WeekDayModelTypeEnum { class WeekDayModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const WeekDayModelTypeEnum._(this.value); const WeekDayModelTypeEnum._(this.value);
@ -190,9 +203,13 @@ class WeekDayModelTypeEnum {
weekDay, weekDay,
]; ];
static WeekDayModelTypeEnum? fromJson(dynamic value) => WeekDayModelTypeEnumTypeTransformer().decode(value); static WeekDayModelTypeEnum? fromJson(dynamic value) =>
WeekDayModelTypeEnumTypeTransformer().decode(value);
static List<WeekDayModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayModelTypeEnum>[]; final result = <WeekDayModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -209,7 +226,8 @@ class WeekDayModelTypeEnum {
/// Transformation class that can [encode] an instance of [WeekDayModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [WeekDayModelTypeEnum] to Object,
/// and [decode] dynamic data back to [WeekDayModelTypeEnum]. /// and [decode] dynamic data back to [WeekDayModelTypeEnum].
class WeekDayModelTypeEnumTypeTransformer { class WeekDayModelTypeEnumTypeTransformer {
factory WeekDayModelTypeEnumTypeTransformer() => _instance ??= const WeekDayModelTypeEnumTypeTransformer._(); factory WeekDayModelTypeEnumTypeTransformer() =>
_instance ??= const WeekDayModelTypeEnumTypeTransformer._();
const WeekDayModelTypeEnumTypeTransformer._(); const WeekDayModelTypeEnumTypeTransformer._();
@ -226,7 +244,8 @@ class WeekDayModelTypeEnumTypeTransformer {
WeekDayModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { WeekDayModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'WeekDay': return WeekDayModelTypeEnum.weekDay; case 'WeekDay':
return WeekDayModelTypeEnum.weekDay;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -239,5 +258,3 @@ class WeekDayModelTypeEnumTypeTransformer {
/// Singleton [WeekDayModelTypeEnumTypeTransformer] instance. /// Singleton [WeekDayModelTypeEnumTypeTransformer] instance.
static WeekDayModelTypeEnumTypeTransformer? _instance; static WeekDayModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -23,15 +23,17 @@ class WeekDayWriteModel {
Object? working; Object? working;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WeekDayWriteModel && bool operator ==(Object other) =>
other.type == type && identical(this, other) ||
other.working == working; other is WeekDayWriteModel &&
other.type == type &&
other.working == working;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(working == null ? 0 : working!.hashCode); (working == null ? 0 : working!.hashCode);
@override @override
String toString() => 'WeekDayWriteModel[type=$type, working=$working]'; String toString() => 'WeekDayWriteModel[type=$type, working=$working]';
@ -63,21 +65,26 @@ class WeekDayWriteModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "WeekDayWriteModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "WeekDayWriteModel[$key]" has a null value in JSON.'); 'Required key "WeekDayWriteModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "WeekDayWriteModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
return WeekDayWriteModel( return WeekDayWriteModel(
type: Object.fromJson(json[r'_type']), type: WeekDayWriteModelTypeEnum.fromJson(json[r'_type']),
working: mapValueOfType<Object>(json, r'working'), working: mapValueOfType<Object>(json, r'working'),
); );
} }
return null; return null;
} }
static List<WeekDayWriteModel> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayWriteModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayWriteModel>[]; final result = <WeekDayWriteModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -105,13 +112,19 @@ class WeekDayWriteModel {
} }
// maps a json object with a list of WeekDayWriteModel-objects as value to a dart map // maps a json object with a list of WeekDayWriteModel-objects as value to a dart map
static Map<String, List<WeekDayWriteModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<WeekDayWriteModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<WeekDayWriteModel>>{}; final map = <String, List<WeekDayWriteModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = WeekDayWriteModel.listFromJson(entry.value, growable: growable,); map[entry.key] = WeekDayWriteModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -124,7 +137,6 @@ class WeekDayWriteModel {
}; };
} }
class WeekDayWriteModelTypeEnum { class WeekDayWriteModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const WeekDayWriteModelTypeEnum._(this.value); const WeekDayWriteModelTypeEnum._(this.value);
@ -144,9 +156,13 @@ class WeekDayWriteModelTypeEnum {
weekDay, weekDay,
]; ];
static WeekDayWriteModelTypeEnum? fromJson(dynamic value) => WeekDayWriteModelTypeEnumTypeTransformer().decode(value); static WeekDayWriteModelTypeEnum? fromJson(dynamic value) =>
WeekDayWriteModelTypeEnumTypeTransformer().decode(value);
static List<WeekDayWriteModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<WeekDayWriteModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WeekDayWriteModelTypeEnum>[]; final result = <WeekDayWriteModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -163,7 +179,8 @@ class WeekDayWriteModelTypeEnum {
/// Transformation class that can [encode] an instance of [WeekDayWriteModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [WeekDayWriteModelTypeEnum] to Object,
/// and [decode] dynamic data back to [WeekDayWriteModelTypeEnum]. /// and [decode] dynamic data back to [WeekDayWriteModelTypeEnum].
class WeekDayWriteModelTypeEnumTypeTransformer { class WeekDayWriteModelTypeEnumTypeTransformer {
factory WeekDayWriteModelTypeEnumTypeTransformer() => _instance ??= const WeekDayWriteModelTypeEnumTypeTransformer._(); factory WeekDayWriteModelTypeEnumTypeTransformer() =>
_instance ??= const WeekDayWriteModelTypeEnumTypeTransformer._();
const WeekDayWriteModelTypeEnumTypeTransformer._(); const WeekDayWriteModelTypeEnumTypeTransformer._();
@ -180,7 +197,8 @@ class WeekDayWriteModelTypeEnumTypeTransformer {
WeekDayWriteModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { WeekDayWriteModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'WeekDay': return WeekDayWriteModelTypeEnum.weekDay; case 'WeekDay':
return WeekDayWriteModelTypeEnum.weekDay;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -193,5 +211,3 @@ class WeekDayWriteModelTypeEnumTypeTransformer {
/// Singleton [WeekDayWriteModelTypeEnumTypeTransformer] instance. /// Singleton [WeekDayWriteModelTypeEnumTypeTransformer] instance.
static WeekDayWriteModelTypeEnumTypeTransformer? _instance; static WeekDayWriteModelTypeEnumTypeTransformer? _instance;
} }

View File

@ -107,56 +107,59 @@ class WorkPackageModel {
WorkPackageModelLinks links; WorkPackageModelLinks links;
@override @override
bool operator ==(Object other) => identical(this, other) || other is WorkPackageModel && bool operator ==(Object other) =>
other.id == id && identical(this, other) ||
other.lockVersion == lockVersion && other is WorkPackageModel &&
other.subject == subject && other.id == id &&
other.type == type && other.lockVersion == lockVersion &&
other.description == description && other.subject == subject &&
other.scheduleManually == scheduleManually && other.type == type &&
other.readonly == readonly && other.description == description &&
other.startDate == startDate && other.scheduleManually == scheduleManually &&
other.dueDate == dueDate && other.readonly == readonly &&
other.date == date && other.startDate == startDate &&
other.derivedStartDate == derivedStartDate && other.dueDate == dueDate &&
other.derivedDueDate == derivedDueDate && other.date == date &&
other.duration == duration && other.derivedStartDate == derivedStartDate &&
other.estimatedTime == estimatedTime && other.derivedDueDate == derivedDueDate &&
other.derivedEstimatedTime == derivedEstimatedTime && other.duration == duration &&
other.ignoreNonWorkingDays == ignoreNonWorkingDays && other.estimatedTime == estimatedTime &&
other.spentTime == spentTime && other.derivedEstimatedTime == derivedEstimatedTime &&
other.percentageDone == percentageDone && other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
other.createdAt == createdAt && other.spentTime == spentTime &&
other.updatedAt == updatedAt && other.percentageDone == percentageDone &&
other.links == links; other.createdAt == createdAt &&
other.updatedAt == updatedAt &&
other.links == links;
@override @override
int get hashCode => int get hashCode =>
// ignore: unnecessary_parenthesis // ignore: unnecessary_parenthesis
(id == null ? 0 : id!.hashCode) + (id == null ? 0 : id!.hashCode) +
(lockVersion == null ? 0 : lockVersion!.hashCode) + (lockVersion == null ? 0 : lockVersion!.hashCode) +
(subject == null ? 0 : subject!.hashCode) + (subject == null ? 0 : subject!.hashCode) +
(type == null ? 0 : type!.hashCode) + (type == null ? 0 : type!.hashCode) +
(description == null ? 0 : description!.hashCode) + (description == null ? 0 : description!.hashCode) +
(scheduleManually == null ? 0 : scheduleManually!.hashCode) + (scheduleManually == null ? 0 : scheduleManually!.hashCode) +
(readonly == null ? 0 : readonly!.hashCode) + (readonly == null ? 0 : readonly!.hashCode) +
(startDate == null ? 0 : startDate!.hashCode) + (startDate == null ? 0 : startDate!.hashCode) +
(dueDate == null ? 0 : dueDate!.hashCode) + (dueDate == null ? 0 : dueDate!.hashCode) +
(date == null ? 0 : date!.hashCode) + (date == null ? 0 : date!.hashCode) +
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) + (derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) + (derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
(duration == null ? 0 : duration!.hashCode) + (duration == null ? 0 : duration!.hashCode) +
(estimatedTime == null ? 0 : estimatedTime!.hashCode) + (estimatedTime == null ? 0 : estimatedTime!.hashCode) +
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) + (derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) + (ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
(spentTime == null ? 0 : spentTime!.hashCode) + (spentTime == null ? 0 : spentTime!.hashCode) +
(percentageDone == null ? 0 : percentageDone!.hashCode) + (percentageDone == null ? 0 : percentageDone!.hashCode) +
(createdAt == null ? 0 : createdAt!.hashCode) + (createdAt == null ? 0 : createdAt!.hashCode) +
(updatedAt == null ? 0 : updatedAt!.hashCode) + (updatedAt == null ? 0 : updatedAt!.hashCode) +
(links.hashCode); (links.hashCode);
@override @override
String toString() => 'WorkPackageModel[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]'; String toString() =>
'WorkPackageModel[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -260,7 +263,7 @@ class WorkPackageModel {
} else { } else {
json[r'updatedAt'] = null; json[r'updatedAt'] = null;
} }
json[r'_links'] = this.links; json[r'_links'] = this.links;
return json; return json;
} }
@ -276,8 +279,10 @@ class WorkPackageModel {
// Note 2: this code is stripped in release mode! // Note 2: this code is stripped in release mode!
assert(() { assert(() {
requiredKeys.forEach((key) { requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "WorkPackageModel[$key]" is missing from JSON.'); assert(json.containsKey(key),
assert(json[key] != null, 'Required key "WorkPackageModel[$key]" has a null value in JSON.'); 'Required key "WorkPackageModel[$key]" is missing from JSON.');
assert(json[key] != null,
'Required key "WorkPackageModel[$key]" has a null value in JSON.');
}); });
return true; return true;
}()); }());
@ -286,7 +291,7 @@ class WorkPackageModel {
id: mapValueOfType<Object>(json, r'id'), id: mapValueOfType<Object>(json, r'id'),
lockVersion: mapValueOfType<Object>(json, r'lockVersion'), lockVersion: mapValueOfType<Object>(json, r'lockVersion'),
subject: mapValueOfType<Object>(json, r'subject'), subject: mapValueOfType<Object>(json, r'subject'),
type: Object.fromJson(json[r'_type']), type: WorkPackageModelTypeEnum.fromJson(json[r'_type']),
description: WorkPackageModelDescription.fromJson(json[r'description']), description: WorkPackageModelDescription.fromJson(json[r'description']),
scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'), scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'),
readonly: mapValueOfType<Object>(json, r'readonly'), readonly: mapValueOfType<Object>(json, r'readonly'),
@ -297,8 +302,10 @@ class WorkPackageModel {
derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'), derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'),
duration: mapValueOfType<Object>(json, r'duration'), duration: mapValueOfType<Object>(json, r'duration'),
estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'), estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'),
derivedEstimatedTime: mapValueOfType<Object>(json, r'derivedEstimatedTime'), derivedEstimatedTime:
ignoreNonWorkingDays: mapValueOfType<Object>(json, r'ignoreNonWorkingDays'), mapValueOfType<Object>(json, r'derivedEstimatedTime'),
ignoreNonWorkingDays:
mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
spentTime: mapValueOfType<Object>(json, r'spentTime'), spentTime: mapValueOfType<Object>(json, r'spentTime'),
percentageDone: mapValueOfType<Object>(json, r'percentageDone'), percentageDone: mapValueOfType<Object>(json, r'percentageDone'),
createdAt: mapValueOfType<Object>(json, r'createdAt'), createdAt: mapValueOfType<Object>(json, r'createdAt'),
@ -309,7 +316,10 @@ class WorkPackageModel {
return null; return null;
} }
static List<WorkPackageModel> listFromJson(dynamic json, {bool growable = false,}) { static List<WorkPackageModel> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WorkPackageModel>[]; final result = <WorkPackageModel>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -337,13 +347,19 @@ class WorkPackageModel {
} }
// maps a json object with a list of WorkPackageModel-objects as value to a dart map // maps a json object with a list of WorkPackageModel-objects as value to a dart map
static Map<String, List<WorkPackageModel>> mapListFromJson(dynamic json, {bool growable = false,}) { static Map<String, List<WorkPackageModel>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
final map = <String, List<WorkPackageModel>>{}; final map = <String, List<WorkPackageModel>>{};
if (json is Map && json.isNotEmpty) { if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments // ignore: parameter_assignments
json = json.cast<String, dynamic>(); json = json.cast<String, dynamic>();
for (final entry in json.entries) { for (final entry in json.entries) {
map[entry.key] = WorkPackageModel.listFromJson(entry.value, growable: growable,); map[entry.key] = WorkPackageModel.listFromJson(
entry.value,
growable: growable,
);
} }
} }
return map; return map;
@ -356,7 +372,6 @@ class WorkPackageModel {
}; };
} }
class WorkPackageModelTypeEnum { class WorkPackageModelTypeEnum {
/// Instantiate a new enum with the provided [value]. /// Instantiate a new enum with the provided [value].
const WorkPackageModelTypeEnum._(this.value); const WorkPackageModelTypeEnum._(this.value);
@ -376,9 +391,13 @@ class WorkPackageModelTypeEnum {
workPackage, workPackage,
]; ];
static WorkPackageModelTypeEnum? fromJson(dynamic value) => WorkPackageModelTypeEnumTypeTransformer().decode(value); static WorkPackageModelTypeEnum? fromJson(dynamic value) =>
WorkPackageModelTypeEnumTypeTransformer().decode(value);
static List<WorkPackageModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) { static List<WorkPackageModelTypeEnum> listFromJson(
dynamic json, {
bool growable = false,
}) {
final result = <WorkPackageModelTypeEnum>[]; final result = <WorkPackageModelTypeEnum>[];
if (json is List && json.isNotEmpty) { if (json is List && json.isNotEmpty) {
for (final row in json) { for (final row in json) {
@ -395,7 +414,8 @@ class WorkPackageModelTypeEnum {
/// Transformation class that can [encode] an instance of [WorkPackageModelTypeEnum] to Object, /// Transformation class that can [encode] an instance of [WorkPackageModelTypeEnum] to Object,
/// and [decode] dynamic data back to [WorkPackageModelTypeEnum]. /// and [decode] dynamic data back to [WorkPackageModelTypeEnum].
class WorkPackageModelTypeEnumTypeTransformer { class WorkPackageModelTypeEnumTypeTransformer {
factory WorkPackageModelTypeEnumTypeTransformer() => _instance ??= const WorkPackageModelTypeEnumTypeTransformer._(); factory WorkPackageModelTypeEnumTypeTransformer() =>
_instance ??= const WorkPackageModelTypeEnumTypeTransformer._();
const WorkPackageModelTypeEnumTypeTransformer._(); const WorkPackageModelTypeEnumTypeTransformer._();
@ -412,7 +432,8 @@ class WorkPackageModelTypeEnumTypeTransformer {
WorkPackageModelTypeEnum? decode(dynamic data, {bool allowNull = true}) { WorkPackageModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) { if (data != null) {
switch (data) { switch (data) {
case 'WorkPackage': return WorkPackageModelTypeEnum.workPackage; case 'WorkPackage':
return WorkPackageModelTypeEnum.workPackage;
default: default:
if (!allowNull) { if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');
@ -425,5 +446,3 @@ class WorkPackageModelTypeEnumTypeTransformer {
/// Singleton [WorkPackageModelTypeEnumTypeTransformer] instance. /// Singleton [WorkPackageModelTypeEnumTypeTransformer] instance.
static WorkPackageModelTypeEnumTypeTransformer? _instance; static WorkPackageModelTypeEnumTypeTransformer? _instance;
} }