Skip to content

Instantly share code, notes, and snippets.

@creativecreatorormaybenot
Last active July 9, 2020 06:11
Show Gist options
  • Save creativecreatorormaybenot/89a94765d6dba72ae652a5c911d4ccf6 to your computer and use it in GitHub Desktop.
Save creativecreatorormaybenot/89a94765d6dba72ae652a5c911d4ccf6 to your computer and use it in GitHub Desktop.
error: An expression whose value can be 'null' must be null-checked before it can be dereferenced - line 9
class Foo {
const Foo({required this.bar});
final void Function()? bar;
void doSomething() {
if (bar != null) {
// Analyzer still complains that bar can be null.
bar();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment