format exported json

Make the exported applications' file more readable in case it is needed to be opened with a text editor.
This commit is contained in:
Giannis Lagodimos
2024-09-22 22:50:17 +03:00
parent 5be2c9b51d
commit f3481f94dd

View File

@ -1598,12 +1598,13 @@ class AppsProvider with ChangeNotifier {
}
String? returnPath;
if (!pickOnly) {
var encoder = const JsonEncoder.withIndent(" ");
Map<String, dynamic> finalExport = generateExportJSON();
var result = await saf.createFile(exportDir,
displayName:
'${tr('obtainiumExportHyphenatedLowercase')}-${DateTime.now().toIso8601String().replaceAll(':', '-')}${isAuto ? '-auto' : ''}.json',
mimeType: 'application/json',
bytes: Uint8List.fromList(utf8.encode(jsonEncode(finalExport))));
bytes: Uint8List.fromList(utf8.encode(encoder.convert(finalExport))));
if (result == null) {
throw ObtainiumError(tr('unexpectedError'));
}