Skip to content

Instantly share code, notes, and snippets.

@gochev
Created March 25, 2024 09:28
Show Gist options
  • Save gochev/82648705cd1a0317595d21a1f3098305 to your computer and use it in GitHub Desktop.
Save gochev/82648705cd1a0317595d21a1f3098305 to your computer and use it in GitHub Desktop.
void main() {
var test = Test(something: [5]);
test.something[0] = 6;
print(test.something); //prints 6
var test2 = Test(something: const [5]);
// test2.something[0] = 6; //this will give you an error
print(test2.something); //prints 6
}
class Test {
List<int> something;
Test({required this.something});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment