When I use async function and then the await keyword, does the code execution stops till await is resolved or do they take the next line of code(or block of code) as .then and continue executing the rest as usual?
Future<void> deleteProduct(String id) async {
final url = Uri.parse(
'https://my-shop-38f1d-default-rtdb.firebaseio.com/products/$id.json?auth=$authToken');
final existingProductIndex = _items.indexWhere((prod) => prod.id == id);
var existingProduct = _items[existingProductIndex];
_items.removeAt(existingProductIndex);
notifyListeners();
final response = await http.delete(url);
if (response.statusCode >= 400) {
items.insert(existingProductIndex, existingProduct);
notifyListeners();
throw HttpException('Could Not Delete Product');
}
}
For example does the execution stops as await http.delete... till it is resolved or the if statement block is considered wrapped in .then statement waiting for the await function while the rest works as it should be?