ifTrue<T> method

T? ifTrue<T>(
  1. T value
)

Returns value if this is true, otherwise null.

isAdmin.ifTrue('Admin Panel') // 'Admin Panel' or null

Implementation

T? ifTrue<T>(T value) => this ? value : null;