TimePickerModel constructor Null safety

TimePickerModel(
  1. {DateTime? currentTime,
  2. bool showSeconds = false,
  3. List<String>? formats,
  4. List<bool>? labels,
  5. List<int>? weights,
  6. List<String>? dividers}
)

Implementation

TimePickerModel({
  DateTime? currentTime,
  this.showSeconds: false,
  List<String>? formats,
  List<bool>? labels,
  List<int>? weights,
  List<String>? dividers,
})  : assert(weights == null || weights.length == 3),
      assert(dividers == null || dividers.length == 2),
      assert(labels == null || labels.length == 3),
      assert(formats == null || formats.length == 3) {
  _weights = weights ?? [1, 1, showSeconds ? 1 : 0];
  _dividers = dividers ?? [':', showSeconds ? ':' : ''];
  _formats = formats ?? [HH, mm, ss];
  _labels = labels ?? [false, false, false];

  _fillHourList();
  _fillMinuteList();
  _fillSecondList();

  this.currentTime = currentTime ?? DateTime.now();

  firstIndex = this.currentTime.hour;
  secondIndex = this.currentTime.minute;
  thirdIndex = this.currentTime.second;
}