createMetroProjectFile static method

MetroProjectFile createMetroProjectFile(
  1. String className, {
  2. Pattern prefix = "",
})

Finds the class name from a className from a String and returns a MetroProjectFile object.

Implementation

static MetroProjectFile createMetroProjectFile(String className,
    {Pattern prefix = ""}) {
  String name = className.replaceAll(prefix, "");
  String? creationPath;

  if (name.contains("/")) {
    List<String> pathSegments = Uri.parse(name).pathSegments.toList();
    name = pathSegments.removeLast();
    creationPath = pathSegments.join("/");
  }
  return MetroProjectFile(name, creationPath: creationPath);
}