initSelects method
void
initSelects(
)
override
Implementation
@override
void initSelects() {
if (picker!.selecteds == null){
picker!.selecteds = <int>[];
}
if(picker!.selecteds.length == 0) {
if(picker!.PassValues!=null){
for(int i=0;i<months.length;i++){
if(months[i]==picker!.PassValues[0]["Month"]){
picker!.selecteds.add(i);
ind=i;
}
}
for(int j=0;j<Generateyears.length;j++){
if(picker!.PassValues[0]["Year"].toString()==Generateyears[j].toString()){
index=j;
picker!.selecteds.add(j);
}
}
picker?.onchanged!({"Month":months[ind],"Year":Generateyears[index]});
}
else{
print("the getter value is : ${picker!.PassValues}");
final DateTime now = DateTime.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);
}
}