Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
Created November 25, 2019 20:15
Show Gist options
  • Save r3dm1ke/df0fd36928809be0d4a710751539a4b8 to your computer and use it in GitHub Desktop.
Save r3dm1ke/df0fd36928809be0d4a710751539a4b8 to your computer and use it in GitHub Desktop.
Different types of variables in Dart
void main() {
// Create a variable name of type String
var name = 'John';
// Create a variable last_name of type String
String last_name = 'Smith';
// Create a dynamic variable age, which is of type int for now
dynamic age = 18;
// Age is now of type List
age = ['what', 'the', 'hell'];
// Declaring a constant variable of type double
const double PI = 3.14;
// This would throw an error
PI = 3;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment