ChordPlayState.fromJson constructor

ChordPlayState.fromJson(
  1. Object? json
)

Lê o JSON guardado; o que não for válido volta ao vazio.

Implementation

factory ChordPlayState.fromJson(Object? json) {
  if (json is! Map) return const ChordPlayState();
  final hash = json['hash'];
  return ChordPlayState(
    hash: hash is String && hash.isNotEmpty ? hash : null,
    played: _strings(json['played']),
    done: _readDone(json['feitos']),
  );
}