buildSnapshotPresentationKey function
Build a stable string key from SnapshotOptions that identifies the presentation parameters. Two snapshots with the same key were captured with equivalent filtering and are directly comparable.
Implementation
String buildSnapshotPresentationKey(SnapshotOptions? options) {
final interactiveOnly = options?.interactiveOnly == true;
final compact = options?.compact == true;
final depth = options?.depth;
final scope = (options?.scope ?? '').trim();
final raw = options?.raw == true;
// Build a deterministic JSON-like string without needing dart:convert.
return '{"interactiveOnly":$interactiveOnly,"compact":$compact'
',"depth":${depth ?? 'null'}'
',"scope":${scope.isEmpty ? 'null' : '"$scope"'}'
',"raw":$raw}';
}