createIf<T> function Null safety

T? createIf<T>(
  1. bool condition,
  2. Factory<T> factory
)

Implementation

T? createIf<T>(bool condition, Factory<T> factory) =>
    condition ? factory() : null;