GetMap method

dynamic GetMap(
  1. int endDate,
  2. int startPosition
)

Implementation

GetMap(int endDate, int startPosition) {
  print("GetMap");
  hasMap = {};
  //List<DateList> dateList = [];
  List<String> str = [];
  int n = 1;
  print(startPosition);
  for (int i = 1; i <= (endDate / 6) + 1; i++) {
    str = [];
    int m = 1;
    for (int j = n; j <= (i == 1 ? 1 : 6 + n); j++) {
      if (i == 1) {
        for (int k = 0; k < 7; k++) {
          if (k < startPosition) {
            str.add("");
          } else {
            str.add(m.toString());

            m += 1;
          }
        }
      } else {
        str.add(endDate >= j ? j.toString() : "");

      }

      hasMap[i] = str;
    }
    n += i == 1 ? m - 1 : 7;
  }
  setState(() {
    hasMap;
  });
  print("Length" + hasMap.length.toString());
}