getDirArgument method
Implementation
Future<void> getDirArgument() async {
if (_dirArgument.isNotEmpty && _jsonPath.isNotEmpty) return;
var projectFile = Directory.current.path;
try {
var file = File(join(projectFile, '.gen_config.yaml'));
if (file.existsSync()) {
var text = loadYaml(await file.readAsString());
if (_dirArgument.isEmpty && text['outputDir'] != null) {
_dirArgument = text['outputDir'];
}
if (_jsonPath.isEmpty && text['jsonPath'] != null) {
_jsonPath = text['jsonPath'];
}
}
file = File(join(projectFile, 'pubspec.yaml'));
var text = loadYaml(await file.readAsString());
if (_dirArgument.isEmpty && text?['gen_cli']?['outputDir'] != null) {
_dirArgument = text['gen_cli']['outputDir'];
}
if (_jsonPath.isEmpty && text?['gen_cli']?['jsonPath'] != null) {
_jsonPath = text['gen_cli']['jsonPath'];
}
} on Exception catch (e) {
LogService.error(e.toString());
}
}