read method
Returns a list of all HttpInteraction
s in the cassette.
Implementation
List<HttpInteraction> read() {
List<HttpInteraction> interactions = [];
if (!_exists()) {
return interactions;
}
File file = File(_filePath);
String fileContents = file.readAsStringSync();
if (fileContents.isNotEmpty) {
List<dynamic> json = jsonDecode(fileContents);
interactions = json.map((e) => HttpInteraction.fromJson(e)).toList();
}
return interactions;
}