How to get total memory size of a device in flutter?

Viewed 3890

I needed the following data of an android/ios device through my flutter app.

  1. Total memory size
  2. Free Memory size
  3. RAM size

How can I get it ?

1 Answers

You can use system_info plugin to get information about system including total and free size of physical and virtual memory. You can get more detail in here.

// values are in byte  
print(SysInfo.getTotalPhysicalMemory());
print(SysInfo.getFreePhysicalMemory());
print(SysInfo.getTotalVirtualMemory());
print(SysInfo.getFreeVirtualMemory());
print(SysInfo.getVirtualMemorySize());

For getting storage space you can use disk_space plugin from here:

// values are in MB 
print(await DiskSpace.getFreeDiskSpace);
print(await DiskSpace.getTotalDiskSpace);
Related