nullable<T> static method

T? nullable<T>(
  1. T value, [
  2. double nullChance = 50
])

Generic

Returns Null or value based on nullChance

Implementation

/// Returns [Null] or [value] based on [nullChance]
static T? nullable<T>(T value, [double nullChance = 50]) {
  return boolean(nullChance) ? null : value;
}