read static method
It's not advised to call await FitKit.read(dataType)
without any extra parameters. This can lead to FAILED BINDER TRANSACTION on Android devices because of the data batch size being too large.
Implementation
static Future<List<FitData>> read(
DataType type, {
required DateTime dateFrom,
required DateTime dateTo,
int? limit,
}) async {
return await _channel
.invokeListMethod('read', {
"type": _dataTypeToString(type),
"date_from": dateFrom.millisecondsSinceEpoch,
"date_to": dateTo.millisecondsSinceEpoch,
"limit": limit,
})
.then(
(response) =>
response!.map((item) => FitData.fromJson(item)).toList(),
)
.catchError(
(_) => throw UnsupportedException(type),
test: (e) {
if (e is PlatformException) return e.code == 'unsupported';
return false;
},
);
}