getClassName static method
Implementation
static String getClassName(List<ModelClassName> listClassName, String suffix,
String name, bool root, bool created, String parent,
[String? parentList]) {
if (root) listClassName.clear();
String apiClassName = root ? '$suffix$name' : '$name$suffix';
if (listClassName.firstWhereOrNull((element) =>
element.className == apiClassName &&
element.parent == parent &&
element.parentList == parentList &&
element.created) !=
null) {
apiClassName = apiClassName;
} else if (listClassName.firstWhereOrNull((element) =>
element.className == apiClassName && element.created) !=
null) {
for (var element in geekLetter) {
final newClassApiName = element + apiClassName;
if (listClassName.firstWhereOrNull((element) =>
element.className == newClassApiName &&
element.parent == parent &&
element.parentList == parentList &&
element.created) !=
null) {
apiClassName = newClassApiName;
break;
}
if (listClassName.firstWhereOrNull((element) =>
element.className == newClassApiName &&
element.parent == parent &&
!element.created) !=
null) {
apiClassName = newClassApiName;
break;
}
if (listClassName.firstWhereOrNull((element) =>
element.className == newClassApiName &&
element.parent != parent) ==
null) {
apiClassName = newClassApiName;
break;
}
}
}
final modelClassName = ModelClassName(
className: apiClassName,
parent: parent,
created: created,
parentList: parentList,
);
listClassName.remove(modelClassName);
listClassName.add(modelClassName);
return apiClassName;
}