toObject method

  1. @override
Object? toObject({
  1. bool parseDateTime = true,
  2. bool parseUri = true,
  3. bool decodeBase64 = false,
  4. bool allowMalformedUtf8 = false,
})
inherited

Transforms the CborValue into a Dart object.

Throws CborCyclicError if cyclic references exist inside this.

Parsing may throw FormatException.

The object is transformed according to the following relations.

Input Output
CborSimpleValue int
CborNull null
CborUndefined null
CborBool bool
CborFloat double
CborDateTimeFloat if (parseDateTime) DateTime else double
CborInt int or BigInt
CborDateTimeInt if (parseDateTime) DateTime else int
CborBytes List<int>
CborBigInt BigInt
CborString String
CborDateTimeString if (parseDateTime) DateTime else String
CborUri if (parseUri) Uri else String
CborBase64 if (decodeBase64) List<int> else String
CborBase64Url if (decodeBase64) List<int> else String
CborRegex String
CborMime String
CborList List
CborDecimalFraction [int exponent, BigInt mantissa]
CborBigFloat [int exponent, BigInt mantissa]
CborMap Map
CborTypedArray TypedData

Implementation

@override
Object? toObject({
  bool parseDateTime = true,
  bool parseUri = true,
  bool decodeBase64 = false,
  bool allowMalformedUtf8 = false,
}) => toObjectInternal(
  {},
  ToObjectOptions(
    parseDateTime: parseDateTime,
    parseUri: parseUri,
    decodeBase64: decodeBase64,
    allowMalformedUtf8: allowMalformedUtf8,
  ),
);