Search code examples
classobjectflutterdart

Syntax meaning for flutter


There is a syntax in the code "?."

The usage is ..

ClassName objectName;
objectName?.function();

Here the function is in the class. Why is the question mark used ?
what type of syntax is this?


Solution

  • It is a null aware operator. See this post: https://flutterigniter.com/checking-null-aware-operators-dart/

    Specifically under the heading 'Safe Navigation Operator'