getValue method

Future<T> getValue(
  1. {dynamic onUnknownValue(
    1. dynamic value

Returns a local Dart copy of the remote Dart object.

This creates a copy of all copyable objects with corresponding VMInstanceRef subclasses. If an uncopyable or unknown instance is encountered, an UnsupportedError is thrown. If an instance has exired, a VMSentinelException is thrown.

If onUnknownValue is provided, it's called with any uncopyable instances or sentinels that are encountered. Its return value is used as the value of that instance or sentinel. It may return a Future, in which case the completion value of the future is used.

This is safe to use with object graphs that contain loops. Within the scope of a call to getValue, including within calls to onUnknownValue, return values are cached, so multiple calls to getValue for the same instance will return identical Dart objects.


Future<T> getValue({onUnknownValue(value)}) =>
    super.getValue(onUnknownValue: onUnknownValue).then((v) => v as T);