Could anyone explain to me why dart formats the code in a way it does it? I have the dart plugin installed and have used the 'Dart: Use recommended settings'.
Future<void> addProduct(Product product) {
return http
.post(
'$url.json',
body: json.encode(
{
'title': product.title,
'description': product.description,
'imageUrl': product.imageUrl,
'price': product.price,
'isFavorite': product.isFavorite,
},
),
)
.then((response) {
var id = json.decode(response.body)['name'];
var newProduct = Product(
description: product.description,
title: product.title,
price: product.price,
imageUrl: product.imageUrl,
id: id,
);
_items.add(newProduct);
notifyListeners();
}).catchError((err) {});
}