What are the differences of followings. when to use a one over the other?
zones: [Zone]
zones: [Zone!]
zones: [Zone]!
zones: [Zone!]!
This can be summarised with this table of allowed values based on the definition:
values         | [Zone] | [Zone!] | [Zone]! | [Zone!]! |
--------------------------------------------------------
null           |    ✔   |    ✔    |    X    |     X    |
[]             |    ✔   |    ✔    |    ✔    |     ✔    |
[null]         |    ✔   |    X    |    ✔    |     X    |
["a","b"]      |    ✔   |    ✔    |    ✔    |     ✔    |
["a",null,"c"] |    ✔   |    X    |    ✔    |     X    |
Most of the time, you will need to use [Zone!]! as it ensures that no null values will be found in your array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With