I have recently jumped to dart after learning core java. Using the similar concept of java, I have tried creating an object of the class 'Product' using the new
keyword to which dart warned "Unnecessary new keyword".
void main() {
Product oil = new Product('sunflower', 2, 300);
final noodles = Product('waiwai', 20, 20); //name, qty, price
}
So, my question is what advantageous is it for us to omit new
in dart and if there are still any situations where using new
keyword is absolutely necessary since it is not completely omitted?