get method
Returns the recorded response for hash, or null if no recording.
Implementation
@override
Future<ModelMessage?> get(String hash) async {
final pending = _pendingWrites[hash];
if (pending != null) return pending;
final f = _fileFor(hash);
if (!await f.exists()) return null;
try {
final json = jsonDecode(await f.readAsString()) as Map<String, dynamic>;
return ModelMessage.fromJson(json);
} catch (e, st) {
_logger.warning(
'failed to decode recording ${hash.length > 8 ? '${hash.substring(0, 8)}...' : hash}',
e,
st,
);
return null;
}
}