getAppUsageDataInRange method
Implementation
@override
Future<Map<String, int>> getAppUsageDataInRange(
DateTime startTime, DateTime endTime) async {
final int startTimeMillis = startTime.millisecondsSinceEpoch;
final int endTimeMillis = endTime.millisecondsSinceEpoch;
final List<dynamic> result = await methodChannel.invokeMethod(
'getAppUsageDataInRange',
{
'startTime': startTimeMillis,
'endTime': endTimeMillis,
},
);
Map<String, int> map = {};
for (var item in result) {
map[item['packageName']] = item['totalTimeInForeground'];
}
return map;
}