mirror of
https://github.com/dancojocaru2000/logic-circuits-simulator.git
synced 2025-02-22 17:19:36 +02:00
Added pretty print for encoded JSON
This commit is contained in:
parent
a126057571
commit
2a19505ed3
2 changed files with 3 additions and 3 deletions
|
@ -40,7 +40,7 @@ class ProjectState extends ChangeNotifier {
|
||||||
final indexFile = await _getIndexFile();
|
final indexFile = await _getIndexFile();
|
||||||
if (!await indexFile.exists()) {
|
if (!await indexFile.exists()) {
|
||||||
_index = const ProjectIndex(components: []);
|
_index = const ProjectIndex(components: []);
|
||||||
await indexFile.writeAsString(jsonEncode(_index.toJson()));
|
await indexFile.writeAsString(const JsonEncoder.withIndent(" ").convert(_index.toJson()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_index = ProjectIndex.fromJson(jsonDecode(await indexFile.readAsString()));
|
_index = ProjectIndex.fromJson(jsonDecode(await indexFile.readAsString()));
|
||||||
|
@ -51,7 +51,7 @@ class ProjectState extends ChangeNotifier {
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
_index = newIndex;
|
_index = newIndex;
|
||||||
final indexFile = await _getIndexFile();
|
final indexFile = await _getIndexFile();
|
||||||
await indexFile.writeAsString(jsonEncode(index.toJson()));
|
await indexFile.writeAsString(const JsonEncoder.withIndent(" ").convert(index.toJson()));
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ProjectsState extends ChangeNotifier {
|
||||||
// Sort projects when updating: latest update first
|
// Sort projects when updating: latest update first
|
||||||
index = newIndex.copyWith(projects: newIndex.projects.toList()..sort((p1, p2) => p2.lastUpdate.compareTo(p1.lastUpdate)));
|
index = newIndex.copyWith(projects: newIndex.projects.toList()..sort((p1, p2) => p2.lastUpdate.compareTo(p1.lastUpdate)));
|
||||||
final indexFile = await _getIndexFile();
|
final indexFile = await _getIndexFile();
|
||||||
await indexFile.writeAsString(jsonEncode(index.toJson()));
|
await indexFile.writeAsString(const JsonEncoder.withIndent(" ").convert(index.toJson()));
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue