Skip to content

Instantly share code, notes, and snippets.

@AlexVegner
Created January 23, 2020 16:42
Show Gist options
  • Select an option

  • Save AlexVegner/ba353b1fe09cee016da0798d9ee296fd to your computer and use it in GitHub Desktop.

Select an option

Save AlexVegner/ba353b1fe09cee016da0798d9ee296fd to your computer and use it in GitHub Desktop.
dart_null_check_operators​.dart
void main() {
String a; // null
if (a == null) {
a = 'Hello';
}
// equivalent to
a ??= 'Hello';
// equivalent to
a = a ?? 'Hello';
a = null;
print(a?.length); // print null
print(a?.length ?? 0); // print 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment