clean method

Future<void> clean({
  1. GenerateConstructType type = GenerateConstructType.constructs,
})

Implementation

Future<void> clean({
  GenerateConstructType type = GenerateConstructType.constructs,
}) async {
  final root = await this.root;

  final server = await root.getServer();
  if (await server.exists() && type.isConstructs) {
    await server.delete(recursive: true);
  }

  final build = await root.getBuild();
  if (await build.exists()) {
    await build.delete(recursive: true);
  }

  if (type.isConstructs) {
    await for (final construct in root.getConstructs()) {
      if (await construct.exists()) {
        await construct.delete(recursive: true);
      }
    }
  }
}