read method
The ledger for blueprint, or null if it has never been applied here.
Implementation
@override
Future<Ledger?> read(String blueprint) async {
final file = _fileFor(blueprint);
if (!file.existsSync()) return null;
try {
final decoded = jsonDecode(await file.readAsString());
if (decoded is! Map) return null;
return Ledger.fromJson(decoded.cast<String, dynamic>());
} on Object {
// A truncated or hand-edited ledger reads as "we own nothing", which is
// the safe direction: the node will adopt what it finds rather than delete
// things on the strength of a file it could not parse.
return null;
}
}