Skip to content

Instantly share code, notes, and snippets.

@givip
Created July 31, 2023 09:14
Show Gist options
  • Save givip/62b2fc0f642507e8ecef27d3bd946c16 to your computer and use it in GitHub Desktop.
Save givip/62b2fc0f642507e8ecef27d3bd946c16 to your computer and use it in GitHub Desktop.
void main(List<String> arguments) {
///--------------------------
///--------------------------
///Which expression is correct?
///If not, why?
///What kind of error/warnings/exceptions you'll get?
// final List<int> l1 = [0];
// l1 = [1];
// print(l1);
//
// final List<int> l2 = [0];
// l2.add(2);
// print(l2);
//
// final List<int> l3 = const [0];
// l3.add(2);
// print(l3);
//
// List<int> l4 = const [0];
// l4.add(2);
// print(l4);
///What is print outputs?
///Why?
// final list1 = [1, 2];
// final list2 = [1, 2];
// final list3 = list1;
//
// print(list1 == list2);
// print(identical(list1, list2));
// print(list1 == list3);
// print(identical(list1, list3));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment