listOrNull<T> function Null safety

Iterable<T>? listOrNull<T>(
  1. T? x
)

Returns List<T> if x is provided or null otherwise.

Implementation

Iterable<T>? listOrNull<T>(T? x) => x == null ? null : [x];