Basics
Hello
Main and Interpolation
Every Dart program runs from main. String interpolation with $name builds output without + concatenation.
Program
Play the program to watch a name flow into a greeting and print.
hello.dart
void main() {
var name = 'Ada';
var greeting = 'Hello, $name!';
print(greeting);
}
main
`void main()` is the program entry point.
var
`var` infers the variable's type from the initializer.
interpolation
`'$name'` embeds a value inside a string.