Issue
While learning dart I came across this line in https://dart.dev/guides/language/language-tour#functions
/// Sets the [bold] and [hidden] flags ...
void enableFlags({bool? bold, bool? hidden}) {...}
Can someone explain the use of the question marks after datatype (bool?)
Solution
This is with null safety, the question mark means that this bool? can possibly be null and flutter will allow you to assign null to it. String can never be null and you'll get an error before compiling.
It is a pretty big thing in Dart, so you better learn it from the official documentation
Answered By - Gaëtan GR
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.