Sarvesh Dalvi
Sarvesh Dalvi

Reputation: 2688

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

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 ?

Upvotes: 12

Views: 8431

Answers (1)

Amir_P
Amir_P

Reputation: 9019

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);

Upvotes: 9

Related Questions