I'm encountering an issue where a specific line in my asynchronous method isn't executing when called from initState. Here's the method in question:
Future<void> loadNetworkImages() async {
final currentImages = await _storageService.loadImages(widget.lineup!.id!);
ref.read(selectedImagesProvider.notifier).state = currentImages.map((image) => image!.url).toList();
}
When I run this, the code execution stops after the await _storageService.loadImages(widget.lineup!.id!)
line and the subsequent line to update the state never executes. This method is called within initState of my widget. The rest of the widget builds as expected, but this part just doesn't seem to progress past the await call.
I'm seeking advice on how to correctly handle or debug this situation. Is there a known issue with executing async operations in initState that I'm missing, or is there a better way to ensure the entire method executes as expected?
Thank you for your help!
_storageService.loadImages
never returns a result, so it's hard to say what the problem might be without knowing more about that. The rest of the widget still builds because that's how async functions work.