toJson method
Returns a Json i.e. Map<String, dynamic> representation of the BaseModel.
Implementation
@override
Map<String, dynamic> toJson({
bool includeNulls = false,
}) {
try {
final className0 = className?.trim().nullIfEmpty;
final fields0 = fields
?.map(
(p0) => p0,
)
.nonNulls
.nullIfEmpty
?.toList();
final shouldInherit0 = shouldInherit;
final inheritanceConstructor0 =
inheritanceConstructor?.trim().nullIfEmpty;
final keyStringCase0 = keyStringCase?.trim().nullIfEmpty;
final description0 = description?.trim().nullIfEmpty;
final tableName0 = tableName?.trim().nullIfEmpty;
final schema0 = schema?.trim().nullIfEmpty;
final indexes0 = indexes
?.map(
(p0) => p0
?.map(
(p0, p1) => MapEntry(
p0?.trim().nullIfEmpty,
p1,
),
)
.nonNulls
.nullIfEmpty,
)
.nonNulls
.nullIfEmpty
?.toList();
final withNulls = {
'tableName': tableName0,
'shouldInherit': shouldInherit0,
'schema': schema0,
'keyStringCase': keyStringCase0,
'inheritanceConstructor': inheritanceConstructor0,
'indexes': indexes0,
'fields': fields0,
'description': description0,
'className': className0,
};
return includeNulls ? withNulls : withNulls.nonNulls;
} catch (e) {
assert(false, '$GenerateDartModel.toJson: $e');
rethrow;
}
}