getPreviousCycleLength method

Future<int> getPreviousCycleLength()

get last cycle length. Default is 0

Implementation

Future<int> getPreviousCycleLength() async {
  List<PeriodsDateRange> allPeriodRange = await getAllPeriodsDetails();
  int lastCycleLength = 0;
  if (allPeriodRange.isNotEmpty) {
    if (allPeriodRange.length > 1) {
      lastCycleLength = allPeriodRange[1].cycleLength!;
    }
  }
  return lastCycleLength;
}