nyLiveInspectJson function

String nyLiveInspectJson(
  1. List<Object?> values
)

Encodes the field values Metro read from nyLiveInspectedState.

Metro calls this with the VM service's evaluate, passing each field's object as a variable in the expression's scope, and decodes the JSON it returns. Values Metro couldn't pass - an uninitialized late field, a value the garbage collector took - arrive as null.

Each value becomes {type, value}, plus count for a collection and truncated when only the first nyLiveInspectItemLimit items were encoded. A value that can't be turned into JSON - a controller, a listener - falls back to its toString(), so a field always describes itself somehow.

Implementation

String nyLiveInspectJson(List<Object?> values) =>
    jsonEncode([for (final Object? value in values) _describeValue(value)]);