Widget build(context) { try{ if (isFirst == true) { fetchImage(); fetchCategories(context); isFirst = false; } }catch(Excepti
The problem can be that you are trying to access a variable/array that is not ready yet (maybe because the future/api call is not finished)
A quick workaround could be to check the length of the array or check for null, example:
Text( (myArray?.length > 0 ? myArray[0] : '') );