i have created two function as follows:
1. to create basemap and view
2. to add sketch widget or some other widgets to it
i am calling both the function from a separate js file in order as follows:
the problem is before completely executing loadbasemap().it try executing addwidget() and throwing error that "view not created".
what could be the reson or how to handle it.
I've found the video that @ReneRubalcava made to be helpful in determining when things are ready to be used: https://www.youtube.com/watch?v=fUz1IGh0sb8&feature=emb_title
It is a little out of date, with "when" replacing "then". He has a newer version of it here, geared towards showing when a layer is ready.
Another thing to look at is calling the addwidget function from within the loadbasemap function when the view is ready.