dataWithPropertyList static method

ByteData dataWithPropertyList(
  1. Object obj
)

For the object graph provided, returns a property list as binary ByteData. Equivalent to iOS method [NSPropertyList dataWithPropertyList:format:options:error]

The obj parameter is the object graph to write out as a binary property list. The object graph may only contain the following types: String, int, Float32, double, Map<String, Object>, List, DateTime, bool or ByteData.

Returns a ByteData of the binary plist.

Throws PropertyListWriteStreamException if the object graph is incompatible.

Implementation

static ByteData dataWithPropertyList(Object obj) {
  try {
    final p = BinaryPropertyListWriter(obj);
    return p.write();
  } catch (e, s) {
    print(s);
    throw PropertyListWriteStreamException.nested(e);
  }
}