initSelects method

  1. @override
void initSelects()
override

Implementation

@override
void initSelects() {
  //  print("set init is : ${picker!.selecteds} and length is : ${picker!.selecteds.length} and maxlevel is : $_maxLevel");

  if (picker!.selecteds == null){
    print("the selcted null : ${picker!.selecteds}");

     picker!.selecteds = <int>[];
  }
  if (picker!.selecteds.length == 0) {
     final DateTime now = DateTime.now();
    print("the selcted length : ${now}");
    var y=Jiffy(now,"yyyy-mm-dd hh:mm:ssZ").format("yyyy");
    var m=Jiffy(now,"yyyy-mm-dd hh:mm:ssZ").format("MMMM");

    int ind=0;
    int index=0;
    for(int i=0;i<months.length;i++){

      if(months[i]==m){

         picker!.selecteds.add(i);
         ind=i;

      }

    }
    for(int j=0;j<Generateyears.length;j++){
      if(y.toString()==Generateyears[j]){
        index=j;
        picker!.selecteds.add(j);
      }
    }
    picker?.onchanged!({"Month":months[ind],"Year":Generateyears[index]});
    // for (int i = 0; i < 2; i++) picker!.selecteds.add(1);
  }
}