serialize method

Object serialize ()

Converts this into a JSON-safe object that can be converted back to a Runtime using Runtime.deserialize.

Implementation

Object serialize() {
  if (builtIn.contains(this)) return identifier;

  if (parent != null) {
    return {
      'name': name,
      'identifier': identifier,
      'parent': parent.serialize()
    };
  }

  return {
    'name': name,
    'identifier': identifier,
    'isDartVM': isDartVM,
    'isBrowser': isBrowser,
    'isJS': isJS,
    'isBlink': isBlink,
    'isHeadless': isHeadless
  };
}