How to convert a List to List in null safe Dart?
Ideally you’d start with a List<String> in the first place. If you’re building your list like: String? s = maybeNullString(); var list = <String?>[ ‘foo’, ‘bar’, someCondition ? ‘baz’ : null, s, ]; then you instead can use collection-if to avoid inserting null elements: String? s = maybeNullString(); var list = <String?>[ ‘foo’, ‘bar’, if … Read more