The "!?" modifier


What is the meaning of “!?” in the declaration on the picture?

1 Like

The !? modifier is used when a parameter must be specified for the API call to make sense, but the value may be null or empty.

A good example of this is fromString: it makes no sense to call fromString without an argument, but null or empty string could be reasonable.

1 Like

Thanks! Are the “!” and “?” independent? Can a parameter be optional (i.e., no “!”) and also nullable/bottom (i.e., just “?”)?


If I’m understanding correctly, that is the same behavior as no modifier.

The options are as follows:

  • no modifier — parameter is optional, no restrictions on values
  • ! — parameter is required and must have a non-empty value
  • !? — parameter is required but may have a null or empty value