Created with <3 with dartpad.dev.
Created
February 7, 2023 03:41
-
-
Save randy-johnson/c9d7704ba818af1b3e6c358c64844f87 to your computer and use it in GitHub Desktop.
fluttering-mirror-3997
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String? name; | |
int? age; | |
//// adding {} allows us to use named arguments | |
//Shorthand we can use the this in the constructor to auto assign | |
Person({ this.name, this.age }); | |
} | |
int addNumbers(int num1, int num2) { | |
return num1 + num2; | |
} | |
void main() { | |
var p1 = Person(name: 'Randy', age: 44); | |
var p2 = Person(name: 'Mandy',age: 25); | |
print(p1); | |
print(p1.name); | |
print(p1.age); | |
print(p2.name); | |
print(p2.age); | |
int firstResult = addNumbers(1, 23); | |
int secondResult = addNumbers(6, 7); | |
print(firstResult); | |
print(secondResult); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment