Skip to content

Instantly share code, notes, and snippets.

@gabrielstellini
Created July 25, 2020 09:14
Show Gist options
  • Save gabrielstellini/b2f2a4607eb2dfed2309246c4916fbc3 to your computer and use it in GitHub Desktop.
Save gabrielstellini/b2f2a4607eb2dfed2309246c4916fbc3 to your computer and use it in GitHub Desktop.
Playing with types on dart
void main() {
strongTypingExample();
weakTypingExample();
}
void printInts(List<int> a) => print(a);
void strongTypingExample() {
var list = <int>[]; // Removing <int> results in a type error
list.add(1);
list.add(2);
print(list);
}
void weakTypingExample() {
dynamic v = 123;
v = 456;
v = 'abc';
print(v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment