CborSimpleCodec constructor Null safety

const CborSimpleCodec(
  1. {bool encodeDateTimeEpoch = false,
  2. bool parseDateTime = true,
  3. bool decodeBase64 = true,
  4. bool parseUri = true,
  5. Object? toEncodable(
    1. dynamic object
    )?}
)

Create a CBOR simple codec.

The toEncodable function is used during encoding. It is invoked for values that are not directly encodable to a CborValue. The function must return an object that is directly encodable. The elements of a returned list and values of a returned map do not need to be directly encodable, and if they aren't, toEncodable will be used on them as well. Please notice that it is possible to cause an infinite recursive regress in this way, by effectively creating an infinite data structure through repeated call to toEncodable.

If toEncodable is omitted, it defaults to a function that returns the result of calling .toCbor() on the unencodable object.

Implementation

const CborSimpleCodec({
  bool encodeDateTimeEpoch = false,
  bool parseDateTime = true,
  bool decodeBase64 = true,
  bool parseUri = true,
  Object? Function(dynamic object)? toEncodable,
})  : _decodeBase64 = decodeBase64,
      _encodeDateTimeEpoch = encodeDateTimeEpoch,
      _parseUri = parseUri,
      _parseDateTime = parseDateTime,
      _toEncodable = toEncodable;