getRoutesFileContent method

String getRoutesFileContent(
  1. String screenName,
  2. String routesFileContent
)

Implementation

String getRoutesFileContent(String screenName, String routesFileContent) {
  String routeName = "";
  if (routesFileContent.contains("abstract class Routes")) {
    String routesData = routesFileContent
        .replaceAll("abstract class Routes {", "")
        .replaceAll("}", "")
        .trim();
    routeName = screenName.routeName;
    routesData =
        "$routesData\nstatic const String $routeName = \"/$routeName\";";

    String finalRoutes = "abstract class Routes {$routesData}";

    return DartFormatter().format(finalRoutes);
  }
  return routesFileContent;
}