decode method

List<NetLensMock> decode(
  1. String content
)

Returns mocks of content, in any format import reads, without saving them. Throws FormatException when the format is unknown.

Implementation

List<NetLensMock> decode(String content) {
  final Object? json = jsonDecode(content);
  final NetLensMockImporter? importer = _importers.firstWhereOrNull(
    (NetLensMockImporter importer) => importer.canImport(json),
  );
  if (importer == null) {
    throw const FormatException('Unknown mocks format.');
  }
  return importer.import(json);
}