queryData static method

Future<Motion?> queryData(
  1. DateTime start,
  2. DateTime end
)

query data between dates from the motion sensor

Implementation

static Future<Motion?> queryData(DateTime start, DateTime end) async {
  try {
    final result = await _motionDetectorMethodChannel.invokeMethod('query', {
      'start': start.millisecondsSinceEpoch,
      'end': end.millisecondsSinceEpoch,
    });
    // print(result);
    return Motion.fromJSON((result as Map<Object?, Object?>)
        .map((key, value) => MapEntry('$key', value)));
  } catch (e) {
    // print(e);
  }
}