Skip to content

Instantly share code, notes, and snippets.

@ezura
Last active May 26, 2018 05:46
Show Gist options
  • Save ezura/809e73461ce6d07434c8926c8703a82a to your computer and use it in GitHub Desktop.
Save ezura/809e73461ce6d07434c8926c8703a82a to your computer and use it in GitHub Desktop.
void main() {
var tmp = "tmp";
final finalVar = tmp;
// Const variables must be initialized with a constant value.
// const constVar = tmp;
const _constVar = "const";
const constVar = _constVar;
print(finalVar + constVar);
}
void main() {
const Null nullVar = null; // type is Null
// type(str);
//str = "change";
print(nullVar.runtimeType.toString());
const String strVar = null;
const int intVar = null;
print(nullVar == strVar);
print(intVar == nullVar);
print(intVar == strVar);
assert(false);
List<int> nums = [1, 2, 3];
//nums.add("4")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment