size 1.0.3-1
size: ^1.0.3-1 copied to clipboard
A simple plugin that can display disk size on desktop.
Disk Size for Desktop #
A simple plugin that displays disk size on Linux and Windows.
Mac not supported, yet.
This plugin does not depend on Flutter.
Features #
-
Available disk space.
-
Free disk space.
-
Disk capacity/size.
-
is_empty extension on io::Directory.
To get available disk space #
import 'package:size/size.dart';
void main() async{
var x = Sizes();
print(x.getAvailableDiskSpace('/home')); // 800007566 -> int
print(x.getFreeDiskSpace('/home')); // 800002566 -> int
print(x.getDiskCapacity('/home')); // 4540002566 -> int
print(await Directory.current.is_empty()); // false -> bool
Note: On linux, if your home, root and any other directory are on different partitions, your partition size will be returned.
Additional information #
Each get.. function returns an int which is actually the disk size in byte.
Difference between getFreeDiskSpace and getAvailableDiskSpace #
According to AlexP on askubuntu
- Free memory is the amount of memory which is currently not used for anything. This number should be small, because memory which is not used is simply wasted.
- Available memory is the amount of memory which is available for allocation to a new process or to existing processes.
Building lib #
If you what to build the lib.
cd size
mkdir build && cd build
cmake -S ..
make