handleFeature method
Implementation
Future<void> handleFeature(
String featurePath,
String featureName,
dynamic featureValue,
String? appsName,
) async {
if (!exists(featurePath)) {
StatusHelper.warning(
'Feature with name $featureName not found in $featurePath!');
return;
}
if (featureValue is! Map) {
StatusHelper.warning(
'Value feature is not valid, please check format json2dart.yaml');
return;
}
fix.add(featurePath);
if (this.featureName != null && pageName != null) {
if (featureValue.keys
.firstWhereOrNull((element) => element == pageName) ==
null) {
StatusHelper.warning(
'$pageName in $featureName not found in json2dart.yaml');
} else {
await handlePage(
featureName: featureName,
featurePath: featurePath,
pageName: pageName!,
pageValue: featureValue[pageName],
appsName: appsName,
);
}
} else {
for (var element in featureValue.entries) {
final pageName = element.key;
final pageValue = element.value;
await handlePage(
featureName: featureName,
featurePath: featurePath,
pageName: pageName,
pageValue: pageValue,
appsName: appsName,
);
}
}
}