Home > Software engineering >  Get hard disk size flutter desktop
Get hard disk size flutter desktop

Time:12-15

Anyone knows who can I get hard disk free size in flutter desktop app ?

I have already try with disk_space package but it's not work with desktop platform.

CodePudding user response:

use this package, https://pub.dev/packages/size

import 'package:size/size.dart';
void main() async{
  await Size.init(); // Initialize plugin
  var x = Size();
  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

or use this package https://pub.dev/packages/disks_desktop

See example here: https://pub.dev/packages/disks_desktop/example

CodePudding user response:

Have you tried this package

universal_disk_space

  • Related