Data Usage gets Mobile/Wifi data usage values from mobile devices, on android it will fetch the data per app but due to current limitations on ios it can only give the total/complete values of overall data used.
Screen Shots
Usage for Android
Initialize plugin and requests for permission
Request Data usage stats
DataUsageModel.init() // Only Required for AndroidList<DataUsageModel> dataUsage = awaitDataUsage.dataUsageAndroid(
withAppIcon: true, // if false `DataUsageModel.appIconBytes` will be null
dataUsageType: DataUsageType.wifi, // DataUsageType.wifi | DataUsageType.mobile
oldVersion: false// will be true for Android versions lower than 23 (MARSHMELLOW)
);
This would return:
[ ...,
DataUsageModel({
String appName; //App's NameString packageName; // App's package nameUint8List appIconBytes; // Icon in bytesint received; // Amount of data Receivedint sent; // Amount of data sent/transferred
})
]
IOSDataUsageModel({
int wifiCompelete, // Total Amount of wifi data (received + sent)int wifiReceived, // Amount of wifi data Receivedint wifiSent, // Amount of data sent/transferredint wwanCompelete, // Total Amount of mobile data (received + sent)int wwanReceived, // Amount of mobile data Receivedint wwanSent // Amount of data sent/transferred
});
Contribution
Lots of PR's would be needed to make this plugin standard, as for iOS there's a permanent limitation for getting the exact data usage, there's only one way arount it and it's super complex.