createIf<T> static method

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

Implementation

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