There are two options over there to clear some list
List<String> foo = ['a', 'b'];
...
foo = [];
// vs
foo.clear();
What is the best option? And when to use these variants?
.clear() will remove data from list with the same reference and foo = [] will have clear data with new reference
Note: .clear() is the best option
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With