getFreeDiskSpaceForPath static method

Future<double?> getFreeDiskSpaceForPath(
  1. String path
)

Returns the amount of free disk space for a specific path.

This is a static method and can be called directly on the DiskSpace class.

Throws an Exception if the specified path does not exist.

Implementation

static Future<double?> getFreeDiskSpaceForPath(String path) async {
  if (!Directory(path).existsSync()) {
    throw Exception("Specified path does not exist");
  }
  final double? freeDiskSpace = await _channel.invokeMethod('getFreeDiskSpaceForPath', {"path": path});
  return freeDiskSpace;
}