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.