loadGoldenJson function

Future<Object?> loadGoldenJson(
  1. String path
)

Loads and decodes a JSON golden from path in VM tests.

Relative paths are resolved from the c2pa_testkit package root rather than the process working directory.

Implementation

Future<Object?> loadGoldenJson(String path) async {
  final pathUri = Uri.file(path);
  final file = pathUri.isAbsolute
      ? File.fromUri(pathUri)
      : File.fromUri((await _packageRoot()).resolveUri(pathUri));
  return jsonDecode(await file.readAsString());
}