displayX method Null safety

void displayX(
  1. {bool flash = true,
  2. bool delayed = false,
  3. bool disableWindow = false,
  4. int? setWindow}
)

Display the value of X. disableWindow applies to the first display of X. If there's a delayed value, it reverts to disableWindow being false.

Implementation

void displayX(
    {bool flash = true,
    bool delayed = false,
    bool disableWindow = false,
    int? setWindow}) {
  final String newNumber = model.formatValue(model.x);
  if (delayed) {
    final initial = model._newLcdContents(disableWindow: disableWindow);
    currentShowingX = newNumber;
    final delayed = model._newLcdContents(disableWindow: false);
    final t = Timer(const Duration(milliseconds: 1400), () {
      show(delayed);
      if (setWindow != null) {
        window = setWindow;
      }
    });
    delayed._myTimer = t;
    initial._myTimer = t;
    show(initial);
  } else {
    currentShowingX = newNumber;
    update(flash: flash, disableWindow: disableWindow);
  }
}