getLastConfig function
Retrieves the last saved configuration map from a JSON file.
This function reads the last_config.json file from the ./clonify/
directory, decodes its JSON content, and returns it as a map.
Note: This function is duplicated in clonify_core.dart. Consider refactoring.
Returns a Future<Map<String, dynamic>?> which is the last saved
configuration, or null if the file does not exist.
Throws a FileSystemException if the file exists but cannot be read, or a FormatException if the file content is not valid JSON.
Implementation
Future<Map<String, dynamic>?> getLastConfig() async {
final file = File('./clonify/last_config.json');
if (file.existsSync()) {
return jsonDecode(await file.readAsString());
}
return null;
}