Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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