toJsonEntry method

String toJsonEntry()

'title': title (models and DateTimes are serialized recursively).

Implementation

String toJsonEntry() {
  if (_isList && isModel) {
    final access = nullable
        ? '$name?.map((e) => e.toJson()).toList()'
        : '$name.map((e) => e.toJson()).toList()';
    return "'$name': $access,";
  }
  if (isModel) {
    final access = nullable ? '$name?.toJson()' : '$name.toJson()';
    return "'$name': $access,";
  }
  if (_isDateTime) {
    final access =
        nullable ? '$name?.toIso8601String()' : '$name.toIso8601String()';
    return "'$name': $access,";
  }
  return "'$name': $name,";
}