Why might a function not get called in initState(){ super.initState()} in flutter, but work perfectly fine if called later in the same page?
问题 I have a function named splitVendorMainCategory, which simply splits a List into two subLists, described as: List vendorMainCategory = ['one', 'two', 'three', 'four']; Future splitVendorMainCategory() async { for (int i=0; i< (vendorMainCategoryLength); i+=2){ vendorMainCategoryC1.add(vendorMainCategory[i]), }, for(int j = 1; j < vendorMainCategoryLength; j+=2){ vendorMainCategoryC2.add(vendorMainCategory[j]), } } And I call it right at the initialisation of the page, but it returns two empty