load method
Implementation
Future<ChordPlayState> load() async {
final latest = _latest;
if (latest != null) return latest;
final String? raw;
try {
raw = await _prefs.getString(key);
} on Object catch (e) {
_unreadable = true;
DiagLog.log('erro', 'tocar pela cifra: não consegui ler "$key": $e');
return const ChordPlayState();
}
_unreadable = false;
if (raw == null) return const ChordPlayState();
try {
return ChordPlayState.fromJson(jsonDecode(raw));
} on Object {
return const ChordPlayState();
}
}