encodeJson method

  1. @override
String encodeJson({
  1. Object encodeTime(
    1. DateTime time
    )?,
})
override

Encodes this element into a JSON string.

Any DateTime objects contained are encoded using encodeTime if provided, or otherwise using DateTime.toIso8601String() method.

Implementation

@override
String encodeJson({Object Function(DateTime time)? encodeTime}) =>
    json.encode(
      toJson(),
      toEncodable: encodeTime != null
          ? (dynamic object) =>
              encodeJsonObject(object, encodeTime: encodeTime)
          : encodeJsonObject,
    );