# remove method

Future<String> remove(

1. String distribution

)

Remove a WSL distro by name

## Implementation

    Future<String> remove(String distribution) async {
      ProcessResult results =
          await Process.run('wsl', ['--unregister', distribution]);

      // Check if folder is empty and delete
      String path = getInstancePath(distribution).path;
      // Wait 10 seconds in async then delete for Windows to release file
      Future.delayed(const Duration(seconds: 10), () {
        Directory dir = Directory(path);
        if (dir.existsSync()) {
          if (dir.listSync().isEmpty) {
            dir.deleteSync(recursive: true);
          }
        }
      });
      return results.stdout;
    }