size 1.0.0
size: ^1.0.0 copied to clipboard
A simple plugin that can display disk size on desktop.
Disk Size for Desktop #
A simple plugin that can display disk size on Linux and Windows. Mac not supported yet.
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()); // true -> bool
Note: On linux, if your home, root and any other directory are on the different partition, you partiton size will returned
Additional information #
Each get.. function return an int which is actally the disk size in byte
Difference between getFreeDiskSpace and getAvailableDiskSpace #
Arrcording 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.
Buliding lib #
If you what to build the lib
cd size
mkdir build && cd build
cmake -S ..
make