Skip to content

Instantly share code, notes, and snippets.

@renatoathaydes
Created November 6, 2020 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoathaydes/6ffce6e1ee6f6698284f4b1245ff59cb to your computer and use it in GitHub Desktop.
Save renatoathaydes/6ffce6e1ee6f6698284f4b1245ff59cb to your computer and use it in GitHub Desktop.
This fails to compile on line 18, but it should work because the field is final so the null check ensures the field can't be null
// Welcome to the null safety version of DartPad!
// This site has a dev channel release of the
// Dart SDK with null safety enabled. You can
// play around with code of your own, or pick a
// learning exercise from the snippets menu at
// the top-right of this page.
void main() {
}
class Hello {
final String? stackTraceString;
Hello({this.stackTraceString});
StackTrace? get stacktrace =>
stackTraceString != null ? StackTrace.fromString(stackTraceString) : null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment